#include "global.h"
#include "credits.h"
#include "data.h"
#include "event_data.h"
#include "event_scripts.h"
#include "field_screen_effect.h"
#include "item.h"
#include "item_icon.h"
#include "list_menu.h"
#include "m4a.h"
#include "main.h"
#include "malloc.h"
#include "map_name_popup.h"
#include "menu.h"
#include "new_game.h"
#include "overworld.h"
#include "pokedex.h"
#include "pokemon.h"
#include "pokemon_icon.h"
#include "pokemon_storage_system.h"
#include "random.h"
#include "region_map.h"
#include "script.h"
#include "script_pokemon_util.h"
#include "sound.h"
#include "string_util.h"
#include "task.h"
#include "pokemon_summary_screen.h"
#include "constants/abilities.h"
#include "constants/items.h"
#include "constants/maps.h"
#include "constants/songs.h"
#include "money.h"
#include "palette.h"
#include "save.h"
#include "coins.h"
#include "daycare.h"
#include "battle_debug.h"
#include "strings.h"
#include "tv.h"
#include "item_use.h"
#include "event_object_lock.h"

#if PMB_ALLOW_CHEAT == 1

// *******************************
// Enums
enum
{ // Main
    DEBUG_MENU_ITEM_UTILITIES,
#if USE_BATTLE_DEBUG==1
    DEBUG_MENU_ITEM_PARTY,
#endif
    DEBUG_MENU_ITEM_FLAGS,
    DEBUG_MENU_ITEM_VARS,
    DEBUG_MENU_ITEM_GIVE,
    DEBUG_MENU_ITEM_SOUND,
    DEBUG_MENU_ITEM_CANCEL
};

enum
{ // Util
    DEBUG_UTIL_MENU_ITEM_HEAL_PARTY,
    DEBUG_UTIL_MENU_ITEM_FLY,
    DEBUG_UTIL_MENU_ITEM_WARP,
    DEBUG_UTIL_MENU_ITEM_PRESETWARP,
    DEBUG_UTIL_MENU_ITEM_SAVESPACE,
    DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK,
    DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK,
    DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY,
    DEBUG_UTIL_MENU_ITEM_WATCHCREDITS,
    // DEBUG_UTIL_MENU_ITEM_TRAINER_NAME,
    // DEBUG_UTIL_MENU_ITEM_RIVAL_NAME,
    DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER,
    DEBUG_UTIL_MENU_ITEM_TRAINER_ID,
//    DEBUG_UTIL_MENU_ITEM_CHECKEVS,
//    DEBUG_UTIL_MENU_ITEM_CHECKIVS,
    DEBUG_UTIL_MENU_ITEM_FORCEEGGHATCH,
    DEBUG_UTIL_MENU_ITEM_OPEN_PC,
    DEBUG_UTIL_MENU_ITEM_DO_WONDER_TRADE,
    // DEBUG_UTIL_MENU_ITEM_CHANGE_COSTUME,
    DEBUG_UTIL_MENU_ITEM_CATCH_CHAIN_STATUS,
    DEBUG_UTIL_MENU_ITEM_CREATE_DAYCARE_EGG,
    // DEBUG_UTIL_MENU_ITEM_CLEAR_BAG,
    DEBUG_UTIL_MENU_ITEM_CLEAR_PARTY,
};

enum
{ // Flags
    DEBUG_FLAG_MENU_ITEM_FLAGS,
    DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS,
    DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF,
    DEBUG_FLAG_MENU_ITEM_NATDEXONOFF,
    DEBUG_FLAG_MENU_ITEM_POKEMONONOFF,
    DEBUG_FLAG_MENU_ITEM_POKENAVONOFF,
    DEBUG_FLAG_MENU_ITEM_FLYANYWHERE,
    DEBUG_FLAG_MENU_ITEM_GETALLBADGES,
     DEBUG_FLAG_MENU_ITEM_COLLISION_ONOFF,
     DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF,
     DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF,
//     DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF,
//     DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF,
//     DEBUG_FLAG_MENU_ITEM_SHINIES_ONOFF,
//     DEBUG_FLAG_MENU_ITEM_ESCAPING_ONOFF,
     DEBUG_FLAG_MENU_ITEM_EXPERIENCE_ONOFF,
     DEBUG_FLAG_MENU_ITEM_RANDOM_ONOFF,
     DEBUG_FLAG_MENU_ITEM_TEAM_ROCKET_ONOFF,
     DEBUG_FLAG_MENU_ITEM_NUZLOCKE_MODE_ONOFF,
     DEBUG_FLAG_MENU_ITEM_BRIGHT_RAY_ONOFF,
     DEBUG_FLAG_MENU_ITEM_DOUBLE_WILD_BATTLE,
//     DEBUG_FLAG_MENU_ITEM_SHINY_HUE_SHIFT_ONOFF,
};
enum

{ // Vars
    DEBUG_VARS_MENU_ITEM_VARS,
};
enum

{ // Give
    DEBUG_GIVE_MENU_GIVE_ITEM,
    DEBUG_GIVE_MENU_GIVE_ALL_TMS,
    DEBUG_GIVE_MENU_GIVE_EGG,
    DEBUG_GIVE_MENU_GIVE_POKEMON_SIMPLE,
    DEBUG_GIVE_MENU_GIVE_POKEMON_COMPLEX,
    DEBUG_GIVE_MENU_GIVE_MAX_MONEY,
    DEBUG_GIVE_MENU_GIVE_MAX_COINS,
    DEBUG_GIVE_MENU_FILL_PC_BOXES,
    DEBUG_GIVE_MENU_FILL_PC_ITEM_STORAGE,
    DEBUG_GIVE_MENU_FILL_ITEMS_POCKET,
    DEBUG_GIVE_MENU_FILL_POKE_BALLS_POCKET,
    DEBUG_GIVE_MENU_FILL_BERRIES_POCKET,
    DEBUG_GIVE_MENU_FILL_KEY_ITEMS_POCKET,
    DEBUG_GIVE_MENU_ITEM_CHEAT,
};
enum

{ //Sound
    DEBUG_SOUND_MENU_ITEM_SE,
    DEBUG_SOUND_MENU_ITEM_MUS,
};

enum
{ // Preset Warps
    DEBUG_UTILITIES_PRESETWARP_LITTLEROOT,
    DEBUG_UTILITIES_PRESETWARP_OLDALE,
    DEBUG_UTILITIES_PRESETWARP_PETALBURG,
    DEBUG_UTILITIES_PRESETWARP_RUSTBORO,
    DEBUG_UTILITIES_PRESETWARP_DEWFORD,
    DEBUG_UTILITIES_PRESETWARP_SLATEPORT,
    DEBUG_UTILITIES_PRESETWARP_MAUVILLE,
    DEBUG_UTILITIES_PRESETWARP_VERDANTURF,
    DEBUG_UTILITIES_PRESETWARP_FALLARBOR,
    DEBUG_UTILITIES_PRESETWARP_LAVARIDGE,
    DEBUG_UTILITIES_PRESETWARP_FORTREE,
    DEBUG_UTILITIES_PRESETWARP_LILYCOVE,
    DEBUG_UTILITIES_PRESETWARP_MOSSDEEP,
    DEBUG_UTILITIES_PRESETWARP_PACIFIDLOG,
    DEBUG_UTILITIES_PRESETWARP_SOOTOPOLIS,
    DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_OUTER,
    DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_INNER,
    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_SIDNEY,
    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_PHOEBE,
    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_GLACIA,
    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_DRAKE,
    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_CHAMPION,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_FACTORY,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_ARENA,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_DOME,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_PIKE,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_PALACE,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_PYRAMID,
    DEBUG_UTILITIES_PRESETWARP_BATTLE_TOWER,
};

// *******************************
// Constants
#define DEBUG_MAIN_MENU_WIDTH 14
#define DEBUG_MAIN_MENU_HEIGHT 8

#define DEBUG_NUMBER_DISPLAY_WIDTH 10
#define DEBUG_NUMBER_DISPLAY_HEIGHT 4

#define DEBUG_NUMBER_DISPLAY_SOUND_WIDTH 20
#define DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT 6

#define DEBUG_NUMBER_DIGITS_FLAGS 4
#define DEBUG_NUMBER_DIGITS_VARIABLES 5
#define DEBUG_NUMBER_DIGITS_VARIABLE_VALUE 5
#define DEBUG_NUMBER_DIGITS_ITEMS 4
#define DEBUG_NUMBER_DIGITS_ITEM_QUANTITY 2

#define DEBUG_NUMBER_ICON_X 210
#define DEBUG_NUMBER_ICON_Y 50

// EWRAM
static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL;

// *******************************
struct DebugMonData
{
    u16 mon_speciesId;
    u8  mon_level;
    u8  isShiny;
    u16 mon_natureId;
    u16 mon_abilityNum;
    u8  mon_iv_hp;
    u8  mon_iv_atk;
    u8  mon_iv_def;
    u8  mon_iv_speed;
    u8  mon_iv_satk;
    u8  mon_iv_sdef;
    u16 mon_move_0;
    u16 mon_move_1;
    u16 mon_move_2;
    u16 mon_move_3;
};

// *******************************
// Define functions
static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate);
static void Debug_DestroyMenu(u8 taskId, bool8 copyToVram);
static void DebugAction_Cancel(u8);
static void DebugAction_DestroyExtraWindow(u8 taskId);

static void DebugAction_OpenUtilitiesMenu(u8);
static void DebugAction_OpenPartyMenu(u8);
static void DebugAction_OpenFlagsMenu(u8);
static void DebugAction_OpenVariablesMenu(u8);
static void DebugAction_OpenGiveMenu(u8);
static void DebugAction_OpenSoundMenu(u8);
static void DebugTask_HandleMenuInput_Main(u8);
static void DebugTask_HandleMenuInput_Utilities(u8);
static void DebugTask_HandleMenuInput_Flags(u8);
static void DebugTask_HandleMenuInput_Vars(u8);
static void DebugTask_HandleMenuInput_Give(u8);
static void DebugTask_HandleMenuInput_Sound(u8);
static void DebugTask_HandleMenuInput_PresetWarp(u8);

// static void DebugTask_ChangeCostume_Execute(u8 taskId);
//static void DebugTask_ChangeCostume_End(u8 taskId);

static void DebugAction_Util_HealParty(u8 taskId);
static void DebugAction_Util_Fly(u8 taskId);
static void DebugAction_Util_Warp_Warp(u8 taskId);
static void DebugAction_Util_Warp_PresetWarp(u8 taskId);
static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId);
static void DebugAction_Util_Warp_SelectMap(u8 taskId);
static void DebugAction_Util_Warp_SelectWarp(u8 taskId);
static void DebugAction_Util_CheckSaveSpace(u8);
static void DebugAction_Util_CheckWallClock(u8);
static void DebugAction_Util_SetWallClock(u8);
static void DebugAction_Util_CheckWeekDay(u8);
static void DebugAction_Util_WatchCredits(u8);
// static void DebugAction_Util_Trainer_Name(u8);
// static void DebugAction_Util_Rival_Name(u8);
static void DebugAction_Util_Trainer_Gender(u8);
static void DebugAction_Util_Trainer_Id(u8);
//static void DebugAction_Util_CheckEVs(u8);
//static void DebugAction_Util_CheckIVs(u8);
static void DebugAction_Util_ForceEggHatch(u8);
static void DebugAction_Util_OpenPC(u8 taskId);
static void DebugAction_Util_DoWonderTrade(u8 taskId);
// static void DebugAction_Util_ChangeCostume(u8 taskId);
static void DebugAction_Util_CatchChainStatus(u8 taskId);
static void DebugAction_Util_CreateDaycareEgg(u8 taskId);
// static void DebugAction_Util_ClearBag(u8 taskId);
static void DebugAction_Util_ClearParty(u8 taskId);

static void DebugAction_Flags_Flags(u8 taskId);
static void DebugAction_Flags_FlagsSelect(u8 taskId);

static void DebugAction_Flags_SetPokedexFlags(u8);
static void DebugAction_Flags_SwitchDex(u8);
static void DebugAction_Flags_SwitchNatDex(u8);
static void DebugAction_Flags_SwitchPokemon(u8);
static void DebugAction_Flags_SwitchPokeNav(u8);
static void DebugAction_Flags_ToggleFlyFlags(u8);
static void DebugAction_Flags_ToggleBadgeFlags(u8);

 static void DebugAction_Flags_CollisionOnOff(u8);
 static void DebugAction_Flags_EncounterOnOff(u8);
 static void DebugAction_Flags_TrainerSeeOnOff(u8);
 static void DebugAction_Flags_BagUseOnOff(u8);
 static void DebugAction_Flags_CatchingOnOff(u8);
 static void DebugAction_Flags_ShiniesOnOff(u8);
 static void DebugAction_Flags_EscapingOnOff(u8);
 static void DebugAction_Flags_ExperienceOnOff(u8);
 static void DebugAction_Flags_RandomOnOff(u8);
 static void DebugAction_Flags_TeamRocketOnOff(u8 taskId);
 static void DebugAction_Flags_NuzlockeModeOnOff(u8 taskId);
 static void DebugAction_Flags_BrightRayOnOff(u8 taskId);
 static void DebugAction_Flags_DoubleBattle(u8);
 static void DebugAction_Flags_ShinyHueShiftOnOff(u8);

static void DebugAction_Vars_Vars(u8 taskId);
static void DebugAction_Vars_Select(u8 taskId);
static void DebugAction_Vars_SetValue(u8 taskId);

static void DebugAction_Give_Item(u8 taskId);
static void DebugAction_Give_Item_SelectId(u8 taskId);
static void DebugAction_Give_Item_SelectQuantity(u8 taskId);
static void DebugAction_Give_AllTMs(u8 taskId);
static void DebugAction_Give_Egg(u8 taskId);
static void DebugAction_Give_Egg_SelectId(u8 taskId);
static void DebugAction_Give_PokemonSimple(u8 taskId);
static void DebugAction_Give_PokemonComplex(u8 taskId);
static void DebugAction_Give_Pokemon_SelectId(u8 taskId);
static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId);
static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId);
static void DebugAction_Give_Pokemon_SelectNature(u8 taskId);
static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId);
static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId);
static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId);
static void DebugAction_Give_Pokemon_Move(u8 taskId);
static void DebugAction_Give_MaxMoney(u8 taskId);
static void DebugAction_Give_MaxCoins(u8 taskId);
static void DebugAction_Give_FillPCBoxes(u8 taskId);
static void DebugAction_Give_FillPCItemStorage(u8 taskId);
 static void DebugAction_Give_FillItemsPocket(u8 taskId);
 static void DebugAction_Give_FillPokeBallsPocket(u8 taskId);
 static void DebugAction_Give_FillBerriesPocket(u8 taskId);
 static void DebugAction_Give_FillKeyItemsPocket(u8 taskId);
static void DebugAction_Give_CHEAT(u8 taskId);

static void DebugAction_Sound_SE(u8 taskId);
static void DebugAction_Sound_SE_SelectId(u8 taskId);
static void DebugAction_Sound_MUS(u8 taskId);
static void DebugAction_Sound_MUS_SelectId(u8 taskId);

static void DebugAction_PresetWarp_LittlerootTown(u8 taskId);
static void DebugAction_PresetWarp_OldaleTown(u8 taskId);
static void DebugAction_PresetWarp_PetalburgCity(u8 taskId);
static void DebugAction_PresetWarp_RustboroCity(u8 taskId);
static void DebugAction_PresetWarp_DewfordTown(u8 taskId);
static void DebugAction_PresetWarp_SlateportCity(u8 taskId);
static void DebugAction_PresetWarp_MauvilleCity(u8 taskId);
static void DebugAction_PresetWarp_VerdanturfTown(u8 taskId);
static void DebugAction_PresetWarp_FallarborTown(u8 taskId);
static void DebugAction_PresetWarp_LavaridgeTown(u8 taskId);
static void DebugAction_PresetWarp_FortreeCity(u8 taskId);
static void DebugAction_PresetWarp_LilycoveCity(u8 taskId);
static void DebugAction_PresetWarp_MossdeepCity(u8 taskId);
static void DebugAction_PresetWarp_PacifidlogTown(u8 taskId);
static void DebugAction_PresetWarp_SootopolisCity(u8 taskId);
static void DebugAction_PresetWarp_EverGrandeCityOuter(u8 taskId);
static void DebugAction_PresetWarp_EverGrandeCityInner(u8 taskId);
static void DebugAction_PresetWarp_PkmnLeagueSidney(u8 taskId);
static void DebugAction_PresetWarp_PkmnLeaguePhoebe(u8 taskId);
static void DebugAction_PresetWarp_PkmnLeagueGlacia(u8 taskId);
static void DebugAction_PresetWarp_PkmnLeagueDrake(u8 taskId);
static void DebugAction_PresetWarp_PkmnLeagueChampion(u8 taskId);
static void DebugAction_PresetWarp_BattleFactory(u8 taskId);
static void DebugAction_PresetWarp_BattleArena(u8 taskId);
static void DebugAction_PresetWarp_BattleDome(u8 taskId);
static void DebugAction_PresetWarp_BattlePike(u8 taskId);
static void DebugAction_PresetWarp_BattlePalace(u8 taskId);
static void DebugAction_PresetWarp_BattlePyramid(u8 taskId);
static void DebugAction_PresetWarp_BattleTower(u8 taskId);

static void DebugTask_HandleMenuInput(u8 taskId, void (*HandleInput)(u8));
static void DebugAction_OpenSubMenu(u8 taskId, struct ListMenuTemplate LMtemplate);

extern u8 EventScript_CheckSavefileSize[];
//extern u8 EventScript_DebugPack[];
extern u8 PlayersHouse_2F_EventScript_SetWallClock[];
extern u8 PlayersHouse_2F_EventScript_CheckWallClock[];
//extern u8 EventScript_GetCurrentDay[];
//extern u8 EventScript_CheckEVs[];
//extern u8 EventScript_CheckIVs[];
extern u8 EventScript_ForceEggHatch[];
extern u8 EventScript_DoWonderTrade[];
//extern u8 Script_CatchingStreak[];
extern void PlayerHandleBattleDebug(void);

#define ABILITY_NAME_LENGTH 12
extern const u8 gAbilityNames[][ABILITY_NAME_LENGTH + 1];

// *******************************
//Maps per map group COPY FROM /include/constants/map_groups.h
 static const u8 MAP_GROUP_COUNT[] = {57, 5, 5, 6, 7, 8, 9, 7, 7, 14, 8, 17, 10, 23, 13, 15, 15, 2, 2, 2, 3, 1, 1, 1, 108, 61, 89, 2, 1, 13, 1, 1, 3, 1, 99};

// Text
// Main Menu
static const u8 sDebugText_Utilities[] =        _("功能");
static const u8 sDebugText_Party[] =            _("队伍");
static const u8 sDebugText_Flags[] =            _("开关");
static const u8 sDebugText_Vars[] =             _("变量");
static const u8 sDebugText_Give[] =             _("赠送");
static const u8 sDebugText_Sound[] =            _("音乐");
static const u8 sDebugText_Cancel[] =           _("取消");
// Util Menu
static const u8 sDebugText_Util_HealParty[] =               _("治疗全队");
static const u8 sDebugText_Util_Fly[] =                     _("自由飞翔");
static const u8 sDebugText_Util_PresetWarp[] =              _("瞬间转移");
static const u8 sDebugText_Util_WarpToMap[] =               _("传送");
static const u8 sDebugText_Util_WarpToMap_SelectMapGroup[] =_("地图组:{STR_VAR_1}\n\n\n{STR_VAR_3}");
static const u8 sDebugText_Util_WarpToMap_SelectMap[] =     _("地图:{STR_VAR_1}{CLEAR_TO 15}\n区域:\n{STR_VAR_2}\n{STR_VAR_3}");
static const u8 sDebugText_Util_WarpToMap_SelectWarp[] =    _("传送:\n{STR_VAR_1}\n\n{STR_VAR_3}");
static const u8 sDebugText_Util_WarpToMap_SelMax[] =        _("{STR_VAR_1}/{STR_VAR_2}");
static const u8 sDebugText_Util_SaveSpace[] =               _("存档剩余");
static const u8 sDebugText_Util_CheckWallClock[] =          _("查看时间");
static const u8 sDebugText_Util_SetWallClock[] =            _("设置时间");
static const u8 sDebugText_Util_CheckWeekDay[] =            _("查看日期");
static const u8 sDebugText_Util_WatchCredits[] =            _("查看名单");
//static const u8 sDebugText_Util_Trainer_Name[] =            _("训练师名");
//static const u8 sDebugText_Util_Rival_Name[] =              _("劲敌名");
static const u8 sDebugText_Util_Trainer_Gender[] =          _("改变性别");
static const u8 sDebugText_Util_Trainer_Id[] =              _("修改训练师ID");
//static const u8 sDebugText_Util_CheckEVs[] =                _("查看努力值");
//static const u8 sDebugText_Util_CheckIVs[] =                _("查看个体值");
static const u8 sDebugText_Util_ForceEggHatch[] =           _("快速孵蛋");
static const u8 sDebugText_Util_OpenPC[] =                  _("打开电脑");
static const u8 sDebugText_Util_DoWonderTrade[] =           _("交换");
//static const u8 sDebugText_Util_ChangeCostume[] =           _("变装");
static const u8 sDebugText_Util_CatchChainStatus[] =        _("捕获连锁率");
static const u8 sDebugText_Util_CreateDaycareEgg[] =        _("生蛋");
//static const u8 sDebugText_Util_ClearBag[] =                _("清空背包");
static const u8 sDebugText_Util_ClearParty[] =              _("清空队伍");
// Flags Menu
static const u8 sDebugText_Flags_Flags[] =                _("编辑开关");
static const u8 sDebugText_Flags_SetPokedexFlags[] =      _("全图鉴");
static const u8 sDebugText_Flags_SwitchDex[] =            _("图鉴 ON/OFF");
static const u8 sDebugText_Flags_SwitchNationalDex[] =    _("全国图鉴 ON/OFF");
static const u8 sDebugText_Flags_SwitchPokemon[] =        _("精灵交换 ON/OFF");
static const u8 sDebugText_Flags_SwitchPokeNav[] =        _("导航 ON/OFF");
static const u8 sDebugText_Flags_ToggleFlyFlags[] =       _("飞空 ON/OFF");
static const u8 sDebugText_Flags_ToggleAllBadges[] =      _("全徽章 ON/OFF");
static const u8 sDebugText_Flags_SwitchCollision[] =      _("穿墙 ON/OFF");
static const u8 sDebugText_Flags_SwitchEncounter[] =      _("遇敌 ON/OFF");
static const u8 sDebugText_Flags_SwitchTrainerSee[] =     _("隐身 ON/OFF");
//static const u8 sDebugText_Flags_SwitchBagUse[] =         _("背包使用 ON/OFF");
//static const u8 sDebugText_Flags_SwitchCatching[] =       _("允许捕获 ON/OFF");
//static const u8 sDebugText_Flags_SwitchShinies[] =        _("闪光. ON/OFF");
//static const u8 sDebugText_Flags_SwitchEscaping[] =       _("逃跑 ON/OFF");
static const u8 sDebugText_Flags_SwitchExperience[] =     _("无经验 ON/OFF");
static const u8 sDebugText_Flags_SwitchRandom[] =     _("随机 无/半/全");
static const u8 sDebugText_Flags_SwitchTeamRocket[] =     _("火箭队 ON/OFF");
static const u8 sDebugText_Flags_SwitchNuzlockeMode[] =     _("Nuzlocke ON/OFF");
static const u8 sDebugText_Flags_SwitchBrightRay[] =     _("明雷 ON/OFF");
static const u8 sDebugText_Flags_DoubleWildBattle[] =     _("野怪双打 ON/OFF");
//static const u8 sDebugText_Flags_SwitchShinyHueShift[] =  _("光泽 ON/OFF");
static const u8 sDebugText_Flag[] =                       _("开关: {STR_VAR_1}\n{STR_VAR_2}\n{STR_VAR_3}");
static const u8 sDebugText_FlagHex[] =                    _("{STR_VAR_1}\n0x{STR_VAR_2}");
static const u8 sDebugText_FlagSet[] =                    _("是");
static const u8 sDebugText_FlagUnset[] =                  _("否");
// Variables Menu
static const u8 sDebugText_Vars_Vars[] =             _("编辑变量");
static const u8 sDebugText_VariableHex[] =           _("{STR_VAR_1}\n0x{STR_VAR_2}");
static const u8 sDebugText_Variable[] =              _("变量: {STR_VAR_1}\n值: {STR_VAR_3}\n{STR_VAR_2}");
static const u8 sDebugText_VariableValueSet[] =      _("变量: {STR_VAR_1}\n值: {STR_VAR_3}\n{STR_VAR_2}");
// Give Menu
static const u8 sDebugText_Give_GiveItem[] =            _("给予道具");
static const u8 sDebugText_ItemQuantity[] =             _("数量:\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_ItemID[] =                   _("道具编号: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_Give_AllTMs[] =              _("全部技能机");
static const u8 sDebugText_Give_Egg[] =                 _("给蛋");
static const u8 sDebugText_Give_GivePokemonSimple[] =   _("精灵(初级)");
static const u8 sDebugText_Give_GivePokemonComplex[] =  _("精灵(高级)");
static const u8 sDebugText_PokemonID[] =                _("种族: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonLevel[] =             _("等级:\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonShiny[] =             _("闪光:\n{STR_VAR_2}\n\n");
static const u8 sDebugText_PokemonNature[] =            _("性格: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonAbility[] =           _("特性: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
//static const u8 sDebugText_PokemonIVs[] =               _("全IV:\n{STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_0[] =              _("IV生命:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_1[] =              _("IV攻击:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_2[] =              _("IV防御:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_3[] =              _("IV速度:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_4[] =              _("IV特攻:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonIV_5[] =              _("IV特防:\n    {STR_VAR_3}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonMove_0[] =            _("技能0: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonMove_1[] =            _("技能1: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonMove_2[] =            _("技能2: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_PokemonMove_3[] =            _("技能3: {STR_VAR_3}\n{STR_VAR_1}\n\n{STR_VAR_2}");
static const u8 sDebugText_Give_MaxMoney[] =            _("无限钱");
static const u8 sDebugText_Give_FillPCBoxes[] =         _("填满某人电脑");
static const u8 sDebugText_Give_FillPCItemStorage[] =   _("填满玩家电脑");
static const u8 sDebugText_Give_FillItemsPocket[] =     _("填满道具背包");
static const u8 sDebugText_Give_FillPokeBallsPocket[] = _("填满球种背包");
static const u8 sDebugText_Give_FillBerriesPocket[] =   _("填满树果背包");
static const u8 sDebugText_Give_FillKeyItemsPocket[] =  _("填满重要道具背包");
static const u8 sDebugText_Give_MaxCoins[] =            _("无限代币");
static const u8 sDebugText_Give_GiveCHEAT[] =           _("作弊大礼包");
// Sound Mneu
static const u8 sDebugText_Sound_SE[] =                 _("效果");
static const u8 sDebugText_Sound_SE_ID[] =              _("声音ID: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}");
static const u8 sDebugText_Sound_MUS[] =                _("音乐");
static const u8 sDebugText_Sound_MUS_ID[] =             _("音乐ID: {STR_VAR_3}\n{STR_VAR_1}\n{STR_VAR_2}");
//static const u8 sDebugText_Sound_Empty[] =              _("");
// Preset Warps
static const u8 sDebugText_Map_LittlerootTown[]      = _("未白镇");
static const u8 sDebugText_Map_OldaleTown[]          = _("古辰镇");
static const u8 sDebugText_Map_PetalburgCity[]       = _("橙华市");
static const u8 sDebugText_Map_RustboroCity[]        = _("卡那兹市");
static const u8 sDebugText_Map_DewfordTown[]         = _("武斗镇");
static const u8 sDebugText_Map_SlateportCity[]       = _("凯那市");
static const u8 sDebugText_Map_MauvilleCity[]        = _("紫堇市");
static const u8 sDebugText_Map_VerdanturfTown[]      = _("绿荫镇");
static const u8 sDebugText_Map_FallarborTown[]       = _("茵郁市");
static const u8 sDebugText_Map_LavaridgeTown[]       = _("釜炎镇");
static const u8 sDebugText_Map_FortreeCity[]         = _("秋叶镇");
static const u8 sDebugText_Map_LilycoveCity[]        = _("水静市");
static const u8 sDebugText_Map_MossdeepCity[]        = _("绿岭市");
static const u8 sDebugText_Map_PacifidlogTown[]      = _("暮水镇");
static const u8 sDebugText_Map_SootopolisCity[]      = _("琉璃市");
static const u8 sDebugText_Map_EverGrandeCityOuter[] = _("彩幽市(下面)");
static const u8 sDebugText_Map_EverGrandeCityInner[] = _("彩幽市(上面)");
static const u8 sDebugText_Map_PkmnLeagueSidney[]    = _("天王1");
static const u8 sDebugText_Map_PkmnLeaguePhoebe[]    = _("天王2");
static const u8 sDebugText_Map_PkmnLeagueGlacia[]    = _("天王3");
static const u8 sDebugText_Map_PkmnLeagueDrake[]     = _("天王4");
static const u8 sDebugText_Map_PkmnLeagueChampion[]  = _("天王5");
static const u8 sDebugText_Map_BattleFactory[]       = _("对战工厂");
static const u8 sDebugText_Map_BattleArena[]         = _("对战竞技场");
static const u8 sDebugText_Map_BattleDome[]          = _("对战巨蛋");
static const u8 sDebugText_Map_BattlePike[]          = _("对战水管");
static const u8 sDebugText_Map_BattlePalace[]        = _("对战宫殿");
static const u8 sDebugText_Map_BattlePyramid[]       = _("对战金字塔");
static const u8 sDebugText_Map_BattleTower[]         = _("对战塔");


static const u8 EventScript_Text_CheckSavefileSize_Part1[] = _("存储1空间: {STR_VAR_1}/{STR_VAR_2} 字节.\n存储2空间 size: {STR_VAR_3}/");
static const u8 EventScript_Text_CheckSavefileSize_Part2[] = _("{STR_VAR_1} 字节.\p精灵盒子空间: {STR_VAR_2}/{STR_VAR_3} 字节.");

static const u8 digitInidicator_1[] =               _("{LEFT_ARROW}+1{RIGHT_ARROW}        ");
static const u8 digitInidicator_10[] =              _("{LEFT_ARROW}+10{RIGHT_ARROW}       ");
static const u8 digitInidicator_100[] =             _("{LEFT_ARROW}+100{RIGHT_ARROW}      ");
static const u8 digitInidicator_1000[] =            _("{LEFT_ARROW}+1000{RIGHT_ARROW}     ");
static const u8 digitInidicator_10000[] =           _("{LEFT_ARROW}+10000{RIGHT_ARROW}    ");
static const u8 digitInidicator_100000[] =          _("{LEFT_ARROW}+100000{RIGHT_ARROW}   ");
static const u8 digitInidicator_1000000[] =         _("{LEFT_ARROW}+1000000{RIGHT_ARROW}  ");
static const u8 digitInidicator_10000000[] =        _("{LEFT_ARROW}+10000000{RIGHT_ARROW} ");
const u8 * const gText_DigitIndicator[] =
{
    digitInidicator_1,
    digitInidicator_10,
    digitInidicator_100,
    digitInidicator_1000,
    digitInidicator_10000,
    digitInidicator_100000,
    digitInidicator_1000000,
    digitInidicator_10000000
};
static const s32 sPowersOfTen[] =
{
             1,
            10,
           100,
          1000,
         10000,
        100000,
       1000000,
      10000000,
     100000000,
    1000000000,
};

// *******************************
// List Menu Items
static const struct ListMenuItem sDebugMenu_Items_Main[] =
{
    [DEBUG_MENU_ITEM_UTILITIES]     = {sDebugText_Utilities,    DEBUG_MENU_ITEM_UTILITIES},
#if USE_BATTLE_DEBUG==1
    [DEBUG_MENU_ITEM_PARTY]         = {sDebugText_Party,    DEBUG_MENU_ITEM_PARTY},
#endif
    [DEBUG_MENU_ITEM_FLAGS]         = {sDebugText_Flags,        DEBUG_MENU_ITEM_FLAGS},
    [DEBUG_MENU_ITEM_VARS]          = {sDebugText_Vars,         DEBUG_MENU_ITEM_VARS},
    [DEBUG_MENU_ITEM_GIVE]          = {sDebugText_Give,         DEBUG_MENU_ITEM_GIVE},
    [DEBUG_MENU_ITEM_SOUND]         = {sDebugText_Sound,        DEBUG_MENU_ITEM_SOUND},
    [DEBUG_MENU_ITEM_CANCEL]        = {sDebugText_Cancel,       DEBUG_MENU_ITEM_CANCEL}
};

static const struct ListMenuItem sDebugMenu_Items_Utilities[] =
{
    [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY]             = {sDebugText_Util_HealParty,           DEBUG_UTIL_MENU_ITEM_HEAL_PARTY},
    [DEBUG_UTIL_MENU_ITEM_FLY]                    = {sDebugText_Util_Fly,                 DEBUG_UTIL_MENU_ITEM_FLY},
    [DEBUG_UTIL_MENU_ITEM_WARP]                   = {sDebugText_Util_WarpToMap,           DEBUG_UTIL_MENU_ITEM_WARP},
    [DEBUG_UTIL_MENU_ITEM_PRESETWARP]             = {sDebugText_Util_PresetWarp,          DEBUG_UTIL_MENU_ITEM_PRESETWARP},
    [DEBUG_UTIL_MENU_ITEM_SAVESPACE]              = {sDebugText_Util_SaveSpace,           DEBUG_UTIL_MENU_ITEM_SAVESPACE},
    [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK]         = {sDebugText_Util_CheckWallClock,      DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK},
    [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK]           = {sDebugText_Util_SetWallClock,        DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK},
    [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY]           = {sDebugText_Util_CheckWeekDay,        DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY},
    [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS]           = {sDebugText_Util_WatchCredits,        DEBUG_UTIL_MENU_ITEM_WATCHCREDITS},
    // [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME]           = {sDebugText_Util_Trainer_Name,        DEBUG_UTIL_MENU_ITEM_TRAINER_NAME},
    // [DEBUG_UTIL_MENU_ITEM_RIVAL_NAME]             = {sDebugText_Util_Rival_Name,          DEBUG_UTIL_MENU_ITEM_RIVAL_NAME},
    [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER]         = {sDebugText_Util_Trainer_Gender,      DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER},
    [DEBUG_UTIL_MENU_ITEM_TRAINER_ID]             = {sDebugText_Util_Trainer_Id,          DEBUG_UTIL_MENU_ITEM_TRAINER_ID},
//    [DEBUG_UTIL_MENU_ITEM_CHECKEVS]               = {sDebugText_Util_CheckEVs,            DEBUG_UTIL_MENU_ITEM_CHECKEVS},
//    [DEBUG_UTIL_MENU_ITEM_CHECKIVS]               = {sDebugText_Util_CheckIVs,            DEBUG_UTIL_MENU_ITEM_CHECKIVS},
    [DEBUG_UTIL_MENU_ITEM_FORCEEGGHATCH]          = {sDebugText_Util_ForceEggHatch,       DEBUG_UTIL_MENU_ITEM_FORCEEGGHATCH},
    [DEBUG_UTIL_MENU_ITEM_OPEN_PC]                = {sDebugText_Util_OpenPC,              DEBUG_UTIL_MENU_ITEM_OPEN_PC},
    [DEBUG_UTIL_MENU_ITEM_DO_WONDER_TRADE]        = {sDebugText_Util_DoWonderTrade,       DEBUG_UTIL_MENU_ITEM_DO_WONDER_TRADE},
    // [DEBUG_UTIL_MENU_ITEM_CHANGE_COSTUME]         = {sDebugText_Util_ChangeCostume,       DEBUG_UTIL_MENU_ITEM_CHANGE_COSTUME},
    [DEBUG_UTIL_MENU_ITEM_CATCH_CHAIN_STATUS]     = {sDebugText_Util_CatchChainStatus,    DEBUG_UTIL_MENU_ITEM_CATCH_CHAIN_STATUS},
    [DEBUG_UTIL_MENU_ITEM_CREATE_DAYCARE_EGG]     = {sDebugText_Util_CreateDaycareEgg,    DEBUG_UTIL_MENU_ITEM_CREATE_DAYCARE_EGG},
    // [DEBUG_UTIL_MENU_ITEM_CLEAR_BAG]              = {sDebugText_Util_ClearBag,            DEBUG_UTIL_MENU_ITEM_CLEAR_BAG},
    [DEBUG_UTIL_MENU_ITEM_CLEAR_PARTY]            = {sDebugText_Util_ClearParty,          DEBUG_UTIL_MENU_ITEM_CLEAR_PARTY},
};
static const struct ListMenuItem sDebugMenu_Items_Flags[] =
{
    [DEBUG_FLAG_MENU_ITEM_FLAGS]                 = {sDebugText_Flags_Flags,               DEBUG_FLAG_MENU_ITEM_FLAGS},
    [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS]          = {sDebugText_Flags_SetPokedexFlags,     DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS},
    [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF]          = {sDebugText_Flags_SwitchDex,           DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF},
    [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF]           = {sDebugText_Flags_SwitchNationalDex,   DEBUG_FLAG_MENU_ITEM_NATDEXONOFF},
    [DEBUG_FLAG_MENU_ITEM_POKEMONONOFF]          = {sDebugText_Flags_SwitchPokemon,       DEBUG_FLAG_MENU_ITEM_POKEMONONOFF},
    [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF]          = {sDebugText_Flags_SwitchPokeNav,       DEBUG_FLAG_MENU_ITEM_POKENAVONOFF},
    [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE]           = {sDebugText_Flags_ToggleFlyFlags,      DEBUG_FLAG_MENU_ITEM_FLYANYWHERE},
    [DEBUG_FLAG_MENU_ITEM_GETALLBADGES]          = {sDebugText_Flags_ToggleAllBadges,     DEBUG_FLAG_MENU_ITEM_GETALLBADGES},
     [DEBUG_FLAG_MENU_ITEM_COLLISION_ONOFF]       = {sDebugText_Flags_SwitchCollision,     DEBUG_FLAG_MENU_ITEM_COLLISION_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF]       = {sDebugText_Flags_SwitchEncounter,     DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]     = {sDebugText_Flags_SwitchTrainerSee,    DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF},
    // [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF]         = {sDebugText_Flags_SwitchBagUse,        DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF},
    // [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF]        = {sDebugText_Flags_SwitchCatching,      DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF},
    // [DEBUG_FLAG_MENU_ITEM_SHINIES_ONOFF]         = {sDebugText_Flags_SwitchShinies,       DEBUG_FLAG_MENU_ITEM_SHINIES_ONOFF},
    // [DEBUG_FLAG_MENU_ITEM_ESCAPING_ONOFF]        = {sDebugText_Flags_SwitchEscaping,      DEBUG_FLAG_MENU_ITEM_ESCAPING_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_EXPERIENCE_ONOFF]      = {sDebugText_Flags_SwitchExperience,    DEBUG_FLAG_MENU_ITEM_EXPERIENCE_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_RANDOM_ONOFF]          = {sDebugText_Flags_SwitchRandom,            DEBUG_FLAG_MENU_ITEM_RANDOM_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_TEAM_ROCKET_ONOFF]     = {sDebugText_Flags_SwitchTeamRocket,            DEBUG_FLAG_MENU_ITEM_TEAM_ROCKET_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_NUZLOCKE_MODE_ONOFF]   = {sDebugText_Flags_SwitchNuzlockeMode,            DEBUG_FLAG_MENU_ITEM_NUZLOCKE_MODE_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_BRIGHT_RAY_ONOFF]      = {sDebugText_Flags_SwitchBrightRay,            DEBUG_FLAG_MENU_ITEM_BRIGHT_RAY_ONOFF},
     [DEBUG_FLAG_MENU_ITEM_DOUBLE_WILD_BATTLE]    = {sDebugText_Flags_DoubleWildBattle,            DEBUG_FLAG_MENU_ITEM_DOUBLE_WILD_BATTLE},
    // [DEBUG_FLAG_MENU_ITEM_SHINY_HUE_SHIFT_ONOFF] = {sDebugText_Flags_SwitchShinyHueShift, DEBUG_FLAG_MENU_ITEM_SHINY_HUE_SHIFT_ONOFF},
};
static const struct ListMenuItem sDebugMenu_Items_Vars[] =
{
    [DEBUG_VARS_MENU_ITEM_VARS]   = {sDebugText_Vars_Vars,       DEBUG_FLAG_MENU_ITEM_FLAGS},
};
static const struct ListMenuItem sDebugMenu_Items_Give[] =
{
    [DEBUG_GIVE_MENU_GIVE_ITEM]              = {sDebugText_Give_GiveItem,            DEBUG_GIVE_MENU_GIVE_ITEM},
    [DEBUG_GIVE_MENU_GIVE_ALL_TMS]           = {sDebugText_Give_AllTMs,              DEBUG_GIVE_MENU_GIVE_ALL_TMS},
    [DEBUG_GIVE_MENU_GIVE_EGG]               = {sDebugText_Give_Egg,                 DEBUG_GIVE_MENU_GIVE_EGG},
    [DEBUG_GIVE_MENU_GIVE_POKEMON_SIMPLE]    = {sDebugText_Give_GivePokemonSimple,   DEBUG_GIVE_MENU_GIVE_POKEMON_SIMPLE},
    [DEBUG_GIVE_MENU_GIVE_POKEMON_COMPLEX]   = {sDebugText_Give_GivePokemonComplex,  DEBUG_GIVE_MENU_GIVE_POKEMON_COMPLEX},
    [DEBUG_GIVE_MENU_GIVE_MAX_MONEY]         = {sDebugText_Give_MaxMoney,            DEBUG_GIVE_MENU_GIVE_MAX_MONEY},
    [DEBUG_GIVE_MENU_GIVE_MAX_COINS]         = {sDebugText_Give_MaxCoins,            DEBUG_GIVE_MENU_GIVE_MAX_COINS},
    [DEBUG_GIVE_MENU_FILL_PC_BOXES]          = {sDebugText_Give_FillPCBoxes,         DEBUG_GIVE_MENU_FILL_PC_BOXES},
    [DEBUG_GIVE_MENU_FILL_PC_ITEM_STORAGE]   = {sDebugText_Give_FillPCItemStorage,   DEBUG_GIVE_MENU_FILL_PC_ITEM_STORAGE},
    [DEBUG_GIVE_MENU_FILL_ITEMS_POCKET]      = {sDebugText_Give_FillItemsPocket,     DEBUG_GIVE_MENU_FILL_ITEMS_POCKET},
    [DEBUG_GIVE_MENU_FILL_POKE_BALLS_POCKET] = {sDebugText_Give_FillPokeBallsPocket, DEBUG_GIVE_MENU_FILL_POKE_BALLS_POCKET},
    [DEBUG_GIVE_MENU_FILL_BERRIES_POCKET]    = {sDebugText_Give_FillBerriesPocket,   DEBUG_GIVE_MENU_FILL_BERRIES_POCKET},
    [DEBUG_GIVE_MENU_FILL_KEY_ITEMS_POCKET]  = {sDebugText_Give_FillKeyItemsPocket,  DEBUG_GIVE_MENU_FILL_KEY_ITEMS_POCKET},
    [DEBUG_GIVE_MENU_ITEM_CHEAT]             = {sDebugText_Give_GiveCHEAT,           DEBUG_GIVE_MENU_ITEM_CHEAT},
};
static const struct ListMenuItem sDebugMenu_Items_Sound[] =
{
    [DEBUG_SOUND_MENU_ITEM_SE]            = {sDebugText_Sound_SE,         DEBUG_SOUND_MENU_ITEM_SE},
    [DEBUG_SOUND_MENU_ITEM_MUS]           = {sDebugText_Sound_MUS,        DEBUG_SOUND_MENU_ITEM_MUS},
};
static const struct ListMenuItem sDebugMenu_Items_Utillities_PresetWarp[] =
{
    [DEBUG_UTILITIES_PRESETWARP_LITTLEROOT]           = {sDebugText_Map_LittlerootTown,      DEBUG_UTILITIES_PRESETWARP_LITTLEROOT},
    [DEBUG_UTILITIES_PRESETWARP_OLDALE]               = {sDebugText_Map_OldaleTown,          DEBUG_UTILITIES_PRESETWARP_OLDALE},
    [DEBUG_UTILITIES_PRESETWARP_PETALBURG]            = {sDebugText_Map_PetalburgCity,       DEBUG_UTILITIES_PRESETWARP_PETALBURG},
    [DEBUG_UTILITIES_PRESETWARP_RUSTBORO]             = {sDebugText_Map_RustboroCity,        DEBUG_UTILITIES_PRESETWARP_RUSTBORO},
    [DEBUG_UTILITIES_PRESETWARP_DEWFORD]              = {sDebugText_Map_DewfordTown,         DEBUG_UTILITIES_PRESETWARP_DEWFORD},
    [DEBUG_UTILITIES_PRESETWARP_SLATEPORT]            = {sDebugText_Map_SlateportCity,       DEBUG_UTILITIES_PRESETWARP_SLATEPORT},
    [DEBUG_UTILITIES_PRESETWARP_MAUVILLE]             = {sDebugText_Map_MauvilleCity,        DEBUG_UTILITIES_PRESETWARP_MAUVILLE},
    [DEBUG_UTILITIES_PRESETWARP_VERDANTURF]           = {sDebugText_Map_VerdanturfTown,      DEBUG_UTILITIES_PRESETWARP_VERDANTURF},
    [DEBUG_UTILITIES_PRESETWARP_FALLARBOR]            = {sDebugText_Map_FallarborTown,       DEBUG_UTILITIES_PRESETWARP_FALLARBOR},
    [DEBUG_UTILITIES_PRESETWARP_LAVARIDGE]            = {sDebugText_Map_LavaridgeTown,       DEBUG_UTILITIES_PRESETWARP_LAVARIDGE},
    [DEBUG_UTILITIES_PRESETWARP_FORTREE]              = {sDebugText_Map_FortreeCity,         DEBUG_UTILITIES_PRESETWARP_FORTREE},
    [DEBUG_UTILITIES_PRESETWARP_LILYCOVE]             = {sDebugText_Map_LilycoveCity,        DEBUG_UTILITIES_PRESETWARP_LILYCOVE},
    [DEBUG_UTILITIES_PRESETWARP_MOSSDEEP]             = {sDebugText_Map_MossdeepCity,        DEBUG_UTILITIES_PRESETWARP_MOSSDEEP},
    [DEBUG_UTILITIES_PRESETWARP_PACIFIDLOG]           = {sDebugText_Map_PacifidlogTown,      DEBUG_UTILITIES_PRESETWARP_PACIFIDLOG},
    [DEBUG_UTILITIES_PRESETWARP_SOOTOPOLIS]           = {sDebugText_Map_SootopolisCity,      DEBUG_UTILITIES_PRESETWARP_SOOTOPOLIS},
    [DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_OUTER]     = {sDebugText_Map_EverGrandeCityOuter, DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_OUTER},
    [DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_INNER]     = {sDebugText_Map_EverGrandeCityInner, DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_INNER},
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_SIDNEY]   = {sDebugText_Map_PkmnLeagueSidney,    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_SIDNEY},
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_PHOEBE]   = {sDebugText_Map_PkmnLeaguePhoebe,    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_PHOEBE},
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_GLACIA]   = {sDebugText_Map_PkmnLeagueGlacia,    DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_GLACIA},
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_DRAKE]    = {sDebugText_Map_PkmnLeagueDrake,     DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_DRAKE},
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_CHAMPION] = {sDebugText_Map_PkmnLeagueChampion,  DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_CHAMPION},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_FACTORY]       = {sDebugText_Map_BattleFactory,       DEBUG_UTILITIES_PRESETWARP_BATTLE_FACTORY},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_ARENA]         = {sDebugText_Map_BattleArena,         DEBUG_UTILITIES_PRESETWARP_BATTLE_ARENA},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_DOME]          = {sDebugText_Map_BattleDome,          DEBUG_UTILITIES_PRESETWARP_BATTLE_DOME},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PIKE]          = {sDebugText_Map_BattlePike,          DEBUG_UTILITIES_PRESETWARP_BATTLE_PIKE},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PALACE]        = {sDebugText_Map_BattlePalace,        DEBUG_UTILITIES_PRESETWARP_BATTLE_PALACE},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PYRAMID]       = {sDebugText_Map_BattlePyramid,       DEBUG_UTILITIES_PRESETWARP_BATTLE_PYRAMID},
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_TOWER]         = {sDebugText_Map_BattleTower,         DEBUG_UTILITIES_PRESETWARP_BATTLE_TOWER},
};

// *******************************
// Menu Actions
static void (*const sDebugMenu_Actions_Main[])(u8) =
{
    [DEBUG_MENU_ITEM_UTILITIES]     = DebugAction_OpenUtilitiesMenu,
#if USE_BATTLE_DEBUG==1
    [DEBUG_MENU_ITEM_PARTY]         = DebugAction_OpenPartyMenu,
#endif
    [DEBUG_MENU_ITEM_FLAGS]         = DebugAction_OpenFlagsMenu,
    [DEBUG_MENU_ITEM_VARS]          = DebugAction_OpenVariablesMenu,
    [DEBUG_MENU_ITEM_GIVE]          = DebugAction_OpenGiveMenu,
    [DEBUG_MENU_ITEM_SOUND]         = DebugAction_OpenSoundMenu,
    [DEBUG_MENU_ITEM_CANCEL]        = DebugAction_Cancel
};
static void (*const sDebugMenu_Actions_Utilities[])(u8) =
{
    [DEBUG_UTIL_MENU_ITEM_HEAL_PARTY]             = DebugAction_Util_HealParty,
    [DEBUG_UTIL_MENU_ITEM_FLY]                    = DebugAction_Util_Fly,
    [DEBUG_UTIL_MENU_ITEM_WARP]                   = DebugAction_Util_Warp_Warp,
    [DEBUG_UTIL_MENU_ITEM_PRESETWARP]             = DebugAction_Util_Warp_PresetWarp,
    [DEBUG_UTIL_MENU_ITEM_SAVESPACE]              = DebugAction_Util_CheckSaveSpace,
    [DEBUG_UTIL_MENU_ITEM_CHECKWALLCLOCK]         = DebugAction_Util_CheckWallClock,
    [DEBUG_UTIL_MENU_ITEM_SETWALLCLOCK]           = DebugAction_Util_SetWallClock,
    [DEBUG_UTIL_MENU_ITEM_CHECKWEEKDAY]           = DebugAction_Util_CheckWeekDay,
    [DEBUG_UTIL_MENU_ITEM_WATCHCREDITS]           = DebugAction_Util_WatchCredits,
    // [DEBUG_UTIL_MENU_ITEM_TRAINER_NAME]           = DebugAction_Util_Trainer_Name,
    // [DEBUG_UTIL_MENU_ITEM_RIVAL_NAME]             = DebugAction_Util_Rival_Name,
    [DEBUG_UTIL_MENU_ITEM_TRAINER_GENDER]         = DebugAction_Util_Trainer_Gender,
    [DEBUG_UTIL_MENU_ITEM_TRAINER_ID]             = DebugAction_Util_Trainer_Id,
//    [DEBUG_UTIL_MENU_ITEM_CHECKEVS]               = DebugAction_Util_CheckEVs,
//    [DEBUG_UTIL_MENU_ITEM_CHECKIVS]               = DebugAction_Util_CheckIVs,
    [DEBUG_UTIL_MENU_ITEM_FORCEEGGHATCH]          = DebugAction_Util_ForceEggHatch,
    [DEBUG_UTIL_MENU_ITEM_OPEN_PC]                = DebugAction_Util_OpenPC,
    [DEBUG_UTIL_MENU_ITEM_DO_WONDER_TRADE]        = DebugAction_Util_DoWonderTrade,
    // [DEBUG_UTIL_MENU_ITEM_CHANGE_COSTUME]         = DebugAction_Util_ChangeCostume,
    // [DEBUG_UTIL_MENU_ITEM_CATCH_CHAIN_STATUS]     = DebugAction_Util_CatchChainStatus,
    [DEBUG_UTIL_MENU_ITEM_CREATE_DAYCARE_EGG]     = DebugAction_Util_CreateDaycareEgg,
    // [DEBUG_UTIL_MENU_ITEM_CLEAR_BAG]              = DebugAction_Util_ClearBag,
    [DEBUG_UTIL_MENU_ITEM_CLEAR_PARTY]            = DebugAction_Util_ClearParty,
};
static void (*const sDebugMenu_Actions_Flags[])(u8) =
{
    [DEBUG_FLAG_MENU_ITEM_FLAGS]                 = DebugAction_Flags_Flags,
    [DEBUG_FLAG_MENU_ITEM_POKEDEXFLAGS]          = DebugAction_Flags_SetPokedexFlags,
    [DEBUG_FLAG_MENU_ITEM_POKEDEXONOFF]          = DebugAction_Flags_SwitchDex,
    [DEBUG_FLAG_MENU_ITEM_NATDEXONOFF]           = DebugAction_Flags_SwitchNatDex,
    [DEBUG_FLAG_MENU_ITEM_POKEMONONOFF]          = DebugAction_Flags_SwitchPokemon,
    [DEBUG_FLAG_MENU_ITEM_POKENAVONOFF]          = DebugAction_Flags_SwitchPokeNav,
    [DEBUG_FLAG_MENU_ITEM_FLYANYWHERE]           = DebugAction_Flags_ToggleFlyFlags,
    [DEBUG_FLAG_MENU_ITEM_GETALLBADGES]          = DebugAction_Flags_ToggleBadgeFlags,
    [DEBUG_FLAG_MENU_ITEM_COLLISION_ONOFF]       = DebugAction_Flags_CollisionOnOff,
    [DEBUG_FLAG_MENU_ITEM_ENCOUNTER_ONOFF]       = DebugAction_Flags_EncounterOnOff,
    [DEBUG_FLAG_MENU_ITEM_TRAINER_SEE_ONOFF]     = DebugAction_Flags_TrainerSeeOnOff,
    // [DEBUG_FLAG_MENU_ITEM_BAG_USE_ONOFF]         = DebugAction_Flags_BagUseOnOff,
    // [DEBUG_FLAG_MENU_ITEM_CATCHING_ONOFF]        = DebugAction_Flags_CatchingOnOff,
    // [DEBUG_FLAG_MENU_ITEM_SHINIES_ONOFF]         = DebugAction_Flags_ShiniesOnOff,
    // [DEBUG_FLAG_MENU_ITEM_ESCAPING_ONOFF]        = DebugAction_Flags_EscapingOnOff,
    [DEBUG_FLAG_MENU_ITEM_EXPERIENCE_ONOFF]      = DebugAction_Flags_ExperienceOnOff,
    [DEBUG_FLAG_MENU_ITEM_RANDOM_ONOFF]          = DebugAction_Flags_RandomOnOff,
    [DEBUG_FLAG_MENU_ITEM_TEAM_ROCKET_ONOFF]          = DebugAction_Flags_TeamRocketOnOff,
    [DEBUG_FLAG_MENU_ITEM_NUZLOCKE_MODE_ONOFF]          = DebugAction_Flags_NuzlockeModeOnOff,
    [DEBUG_FLAG_MENU_ITEM_BRIGHT_RAY_ONOFF]          = DebugAction_Flags_BrightRayOnOff,
    [DEBUG_FLAG_MENU_ITEM_DOUBLE_WILD_BATTLE]          = DebugAction_Flags_DoubleBattle,
    // [DEBUG_FLAG_MENU_ITEM_SHINY_HUE_SHIFT_ONOFF] = DebugAction_Flags_ShinyHueShiftOnOff,
};
static void (*const sDebugMenu_Actions_Vars[])(u8) =
{
    [DEBUG_VARS_MENU_ITEM_VARS]     = DebugAction_Vars_Vars,
};
static void (*const sDebugMenu_Actions_Give[])(u8) =
{
    [DEBUG_GIVE_MENU_GIVE_ITEM]              = DebugAction_Give_Item,
    [DEBUG_GIVE_MENU_GIVE_ALL_TMS]           = DebugAction_Give_AllTMs,
    [DEBUG_GIVE_MENU_GIVE_EGG]               = DebugAction_Give_Egg,
    [DEBUG_GIVE_MENU_GIVE_POKEMON_SIMPLE]    = DebugAction_Give_PokemonSimple,
    [DEBUG_GIVE_MENU_GIVE_POKEMON_COMPLEX]   = DebugAction_Give_PokemonComplex,
    [DEBUG_GIVE_MENU_GIVE_MAX_MONEY]         = DebugAction_Give_MaxMoney,
    [DEBUG_GIVE_MENU_GIVE_MAX_COINS]         = DebugAction_Give_MaxCoins,
    [DEBUG_GIVE_MENU_FILL_PC_BOXES]          = DebugAction_Give_FillPCBoxes,
    [DEBUG_GIVE_MENU_FILL_PC_ITEM_STORAGE]   = DebugAction_Give_FillPCItemStorage,
    [DEBUG_GIVE_MENU_FILL_ITEMS_POCKET]      = DebugAction_Give_FillItemsPocket,
    [DEBUG_GIVE_MENU_FILL_POKE_BALLS_POCKET] = DebugAction_Give_FillPokeBallsPocket,
    [DEBUG_GIVE_MENU_FILL_BERRIES_POCKET]    = DebugAction_Give_FillBerriesPocket,
    [DEBUG_GIVE_MENU_FILL_KEY_ITEMS_POCKET]  = DebugAction_Give_FillKeyItemsPocket,
    [DEBUG_GIVE_MENU_ITEM_CHEAT]             = DebugAction_Give_CHEAT,
};
static void (*const sDebugMenu_Actions_Sound[])(u8) =
{
    [DEBUG_SOUND_MENU_ITEM_SE]      = DebugAction_Sound_SE,
    [DEBUG_SOUND_MENU_ITEM_MUS]     = DebugAction_Sound_MUS,
};
static void (*const sDebugMenu_Actions_PresetWarp[])(u8) =
{
    [DEBUG_UTILITIES_PRESETWARP_LITTLEROOT]           = DebugAction_PresetWarp_LittlerootTown,
    [DEBUG_UTILITIES_PRESETWARP_OLDALE]               = DebugAction_PresetWarp_OldaleTown,
    [DEBUG_UTILITIES_PRESETWARP_PETALBURG]            = DebugAction_PresetWarp_PetalburgCity,
    [DEBUG_UTILITIES_PRESETWARP_RUSTBORO]             = DebugAction_PresetWarp_RustboroCity,
    [DEBUG_UTILITIES_PRESETWARP_DEWFORD]              = DebugAction_PresetWarp_DewfordTown,
    [DEBUG_UTILITIES_PRESETWARP_SLATEPORT]            = DebugAction_PresetWarp_SlateportCity,
    [DEBUG_UTILITIES_PRESETWARP_MAUVILLE]             = DebugAction_PresetWarp_MauvilleCity,
    [DEBUG_UTILITIES_PRESETWARP_VERDANTURF]           = DebugAction_PresetWarp_VerdanturfTown,
    [DEBUG_UTILITIES_PRESETWARP_FALLARBOR]            = DebugAction_PresetWarp_FallarborTown,
    [DEBUG_UTILITIES_PRESETWARP_LAVARIDGE]            = DebugAction_PresetWarp_LavaridgeTown,
    [DEBUG_UTILITIES_PRESETWARP_FORTREE]              = DebugAction_PresetWarp_FortreeCity,
    [DEBUG_UTILITIES_PRESETWARP_LILYCOVE]             = DebugAction_PresetWarp_LilycoveCity,
    [DEBUG_UTILITIES_PRESETWARP_MOSSDEEP]             = DebugAction_PresetWarp_MossdeepCity,
    [DEBUG_UTILITIES_PRESETWARP_PACIFIDLOG]           = DebugAction_PresetWarp_PacifidlogTown,
    [DEBUG_UTILITIES_PRESETWARP_SOOTOPOLIS]           = DebugAction_PresetWarp_SootopolisCity,
    [DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_OUTER]     = DebugAction_PresetWarp_EverGrandeCityOuter,
    [DEBUG_UTILITIES_PRESETWARP_EVERGRANDE_INNER]     = DebugAction_PresetWarp_EverGrandeCityInner,
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_SIDNEY]   = DebugAction_PresetWarp_PkmnLeagueSidney,
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_PHOEBE]   = DebugAction_PresetWarp_PkmnLeaguePhoebe,
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_GLACIA]   = DebugAction_PresetWarp_PkmnLeagueGlacia,
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_DRAKE]    = DebugAction_PresetWarp_PkmnLeagueDrake,
    [DEBUG_UTILITIES_PRESETWARP_PKMN_LEAGUE_CHAMPION] = DebugAction_PresetWarp_PkmnLeagueChampion,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_FACTORY]       = DebugAction_PresetWarp_BattleFactory,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_ARENA]         = DebugAction_PresetWarp_BattleArena,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_DOME]          = DebugAction_PresetWarp_BattleDome,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PIKE]          = DebugAction_PresetWarp_BattlePike,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PALACE]        = DebugAction_PresetWarp_BattlePalace,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_PYRAMID]       = DebugAction_PresetWarp_BattlePyramid,
    [DEBUG_UTILITIES_PRESETWARP_BATTLE_TOWER]         = DebugAction_PresetWarp_BattleTower,
};

// *******************************
// Windows
static const struct WindowTemplate sDebugMenuWindowTemplate =
{
    .bg = 0,
    .tilemapLeft = 1,
    .tilemapTop = 1,
    .width = DEBUG_MAIN_MENU_WIDTH,
    .height = 2 * DEBUG_MAIN_MENU_HEIGHT,
    .paletteNum = 15,
    .baseBlock = 1,
};
static const struct WindowTemplate sDebugNumberDisplayWindowTemplate =
{
    .bg = 0,
    .tilemapLeft = 5 + DEBUG_MAIN_MENU_WIDTH,
    .tilemapTop = 1,
    .width = DEBUG_NUMBER_DISPLAY_WIDTH,
    .height = 2 * DEBUG_NUMBER_DISPLAY_HEIGHT,
    .paletteNum = 15,
    .baseBlock = 1,
};
static const struct WindowTemplate sDebugNumberDisplayLargeWindowTemplate =
{
    .bg = 0,
    .tilemapLeft = 30 - DEBUG_NUMBER_DISPLAY_SOUND_WIDTH -1,
    .tilemapTop = 1,
    .width = DEBUG_NUMBER_DISPLAY_SOUND_WIDTH,
    .height = DEBUG_NUMBER_DISPLAY_SOUND_HEIGHT,
    .paletteNum = 15,
    .baseBlock = 1,
};
static const struct WindowTemplate sPresetWarpWindowTemplate =
{
    .bg = 0,
    .tilemapLeft = 1,
    .tilemapTop = 1,
    .width = DEBUG_MAIN_MENU_WIDTH + 5,
    .height = 2 * DEBUG_MAIN_MENU_HEIGHT,
    .paletteNum = 15,
    .baseBlock = 1,
};

// *******************************
// List Menu Templates
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Main =
{
    .items = sDebugMenu_Items_Main,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Main),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Utilities =
{
    .items = sDebugMenu_Items_Utilities,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Utilities),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Flags =
{
    .items = sDebugMenu_Items_Flags,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Flags),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Vars =
{
    .items = sDebugMenu_Items_Vars,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Vars),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Give =
{
    .items = sDebugMenu_Items_Give,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Give),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_Sound =
{
    .items = sDebugMenu_Items_Sound,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Sound),
};
static const struct ListMenuTemplate sDebugMenu_ListTemplate_PresetWarp =
{
    .items = sDebugMenu_Items_Utillities_PresetWarp,
    .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
    .totalItems = ARRAY_COUNT(sDebugMenu_Items_Utillities_PresetWarp),
};

// *******************************
// Functions universal
u16 VarGetIfExist(u16 id)
{
    u16 *ptr = GetVarPointer(id);
    if (!ptr)
        return ~0;
    return *ptr;
}
//返回上一次的值
u8 FlagToggle(u16 id)
{
   u8 *ptr = GetFlagPointer(id);
   if (ptr)
   {
       u8 result = (*ptr >> (id & 7) & 1);
       *ptr ^= 1 << (id & 7);
       return result;
   }
   return 0;
}

//#define END_SE                      SE_SUDOWOODO_SHAKE
//#define START_MUS                   END_SE + 1
//#define END_MUS                     MUS_RG_TEACHY_TV_MENU

#define SECTOR_DATA_SIZE 3968

bool8 Debug_ShowMainMenu(void)
{
    Debug_ShowMenu(DebugTask_HandleMenuInput_Main, sDebugMenu_ListTemplate_Main);

    return FALSE;
}

static void Debug_ShowMenu(void (*HandleInput)(u8), struct ListMenuTemplate LMtemplate)
{
    struct ListMenuTemplate menuTemplate;
    u8 windowId;
    u8 menuTaskId;
    u8 inputTaskId;

    // create window
    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugMenuWindowTemplate);
    DrawStdWindowFrame(windowId, TRUE);

    // create list menu
    menuTemplate = LMtemplate;
    menuTemplate.maxShowed = DEBUG_MAIN_MENU_HEIGHT;
    menuTemplate.windowId = windowId;
    menuTemplate.header_X = 0;
    menuTemplate.item_X = 8;
    menuTemplate.cursor_X = 0;
    menuTemplate.upText_Y = 1;
    menuTemplate.cursorPal = 2;
    menuTemplate.fillValue = 1;
    menuTemplate.cursorShadowPal = 3;
    menuTemplate.lettersSpacing = 1;
    menuTemplate.itemVerticalPadding = 0;
    menuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
    menuTemplate.fontId = 1;
    menuTemplate.cursorKind = 0;
    menuTaskId = ListMenuInit(&menuTemplate, 0, 0);

    // draw everything
    CopyWindowToVram(windowId, 3);

    // create input handler task
    inputTaskId = CreateTask(HandleInput, 3);
    gTasks[inputTaskId].data[0] = menuTaskId;
    gTasks[inputTaskId].data[1] = windowId;
}
static void Debug_DestroyMenu(u8 taskId, bool8 copyToVram)
{
    DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL);
    ClearStdWindowAndFrame(gTasks[taskId].data[1], copyToVram);
    RemoveWindow(gTasks[taskId].data[1]);
    DestroyTask(taskId);
}
static void DebugAction_Cancel(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}
static void DebugAction_DestroyExtraWindow(u8 taskId)
{
    ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE);
    RemoveWindow(gTasks[taskId].data[1]);

    ClearStdWindowAndFrame(gTasks[taskId].data[2], TRUE);
    RemoveWindow(gTasks[taskId].data[2]);

    DestroyTask(taskId);
    EnableBothScriptContexts();
}
// *******************************
// Handle Inputs
static void DebugTask_HandleMenuInput_Main(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Main[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, TRUE);
        ScriptUnfreezeObjectEvents();
        EnableBothScriptContexts();
    }
}
static void DebugTask_HandleMenuInput_Utilities(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Utilities[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMainMenu();
    }
}
static void DebugTask_HandleMenuInput_Flags(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Flags[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMainMenu();
    }
}
static void DebugTask_HandleMenuInput_Vars(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Vars[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMainMenu();
    }
}
static void DebugTask_HandleMenuInput_Give(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Give[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMainMenu();
    }
}
static void DebugTask_HandleMenuInput_Sound(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_Sound[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMainMenu();
    }
}

// *******************************
// Open sub-menus
static void DebugAction_OpenUtilitiesMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities);
}
static void DebugAction_OpenPartyMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    PlayerHandleBattleDebug();
}
static void DebugAction_OpenFlagsMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    Debug_ShowMenu(DebugTask_HandleMenuInput_Flags, sDebugMenu_ListTemplate_Flags);
}
static void DebugAction_OpenVariablesMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars);
}
static void DebugAction_OpenGiveMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
}
static void DebugAction_OpenSoundMenu(u8 taskId)
{
    Debug_DestroyMenu(taskId, FALSE);
    Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound);
}

// *******************************
// Actions Utilities
static void DebugAction_Util_HealParty(u8 taskId)
{
    PlaySE(SE_USE_ITEM);
    HealPlayerParty();
    EnableBothScriptContexts();
    Debug_DestroyMenu(taskId, TRUE);
}
static void DebugAction_Util_Fly(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetMainCallback2(CB2_OpenFlyMap);
}

static void DebugAction_Util_Warp_PresetWarp(u8 taskId)
{
    struct ListMenuTemplate menuTemplate;
    u8 windowId;
    u8 menuTaskId;
    u8 inputTaskId;

    // erase existing window
    Debug_DestroyMenu(taskId, FALSE);

    // create window
    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sPresetWarpWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    // create list menu
    menuTemplate = sDebugMenu_ListTemplate_PresetWarp;
    menuTemplate.maxShowed = DEBUG_MAIN_MENU_HEIGHT;
    menuTemplate.windowId = windowId;
    menuTemplate.header_X = 0;
    menuTemplate.item_X = 8;
    menuTemplate.cursor_X = 0;
    menuTemplate.upText_Y = 1;
    menuTemplate.cursorPal = 2;
    menuTemplate.fillValue = 1;
    menuTemplate.cursorShadowPal = 3;
    menuTemplate.lettersSpacing = 1;
    menuTemplate.itemVerticalPadding = 0;
    menuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
    menuTemplate.fontId = 1;
    menuTemplate.cursorKind = 0;
    menuTaskId = ListMenuInit(&menuTemplate, 0, 0);

    // draw everything
    CopyWindowToVram(windowId, 3);

    // create input handler task
    inputTaskId = CreateTask(DebugTask_HandleMenuInput_PresetWarp, 3);
    gTasks[inputTaskId].data[0] = menuTaskId;
    gTasks[inputTaskId].data[1] = windowId;
}

static void DebugTask_HandleMenuInput_PresetWarp(u8 taskId)
{
    void (*func)(u8);
    u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        if ((func = sDebugMenu_Actions_PresetWarp[input]) != NULL)
            func(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities);
    }
}

static void DebugAction_AddTextPrinter(u8 windowId, const u8* str)
{
    FillWindowPixelBuffer(windowId, 0x11);
    AddTextPrinterParameterized(windowId, 1, str, 1, 1, 0, NULL);
}
#define _AddTextPrinterParameterized(windowId, fontID, string,x, y, speed, callback) DebugAction_AddTextPrinter(windowId, string)
static void DebugAction_Util_Warp_Warp(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);


    ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
    ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT-1, STR_CONV_MODE_LEADING_ZEROS, 2);
    StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
    StringCopy(gStringVar3, gText_DigitIndicator[0]);
    StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMapGroup);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    gTasks[taskId].func = DebugAction_Util_Warp_SelectMapGroup;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 0;            //Current Flag
    gTasks[taskId].data[4] = 0;            //Digit Selected
    gTasks[taskId].data[5] = 0; //Map Group
    gTasks[taskId].data[6] = 0; //Map
    gTasks[taskId].data[7] = 0; //warp
}
static void DebugAction_Util_Warp_SelectMapGroup(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);
        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > MAP_GROUPS_COUNT-1)
                gTasks[taskId].data[3] = MAP_GROUPS_COUNT-1;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 2)
                gTasks[taskId].data[4] += 1;
        }

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        ConvertIntToDecimalStringN(gStringVar2, MAP_GROUPS_COUNT-1, STR_CONV_MODE_LEADING_ZEROS, 2);
        StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMapGroup);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        gTasks[taskId].data[5] = gTasks[taskId].data[3];
        gTasks[taskId].data[3] = 0;
        gTasks[taskId].data[4] = 0;

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]]-1, STR_CONV_MODE_LEADING_ZEROS, 2);
        StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
        GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0);
        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMap);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Util_Warp_SelectMap;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities);
    }
}
static void DebugAction_Util_Warp_SelectMap(u8 taskId)
{
    u8 max_value = MAP_GROUP_COUNT[gTasks[taskId].data[5]]; //maps in the selected map group

    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);
        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > max_value-1)
                gTasks[taskId].data[3] = max_value-1;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 2)
                gTasks[taskId].data[4] += 1;
        }

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        ConvertIntToDecimalStringN(gStringVar2, MAP_GROUP_COUNT[gTasks[taskId].data[5]]-1, STR_CONV_MODE_LEADING_ZEROS, 2);
        StringExpandPlaceholders(gStringVar1, sDebugText_Util_WarpToMap_SelMax);
        GetMapName(gStringVar2, Overworld_GetMapHeaderByGroupAndId(gTasks[taskId].data[5], gTasks[taskId].data[3])->regionMapSectionId, 0);
        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectMap);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        gTasks[taskId].data[6] = gTasks[taskId].data[3];
        gTasks[taskId].data[3] = 0;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectWarp);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
        gTasks[taskId].func = DebugAction_Util_Warp_SelectWarp;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities);
    }
}
static void DebugAction_Util_Warp_SelectWarp(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);
        if (gMain.newKeys & DPAD_UP || gMain.newKeys & DPAD_RIGHT)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > 10)
                gTasks[taskId].data[3] = 10;
        }
        if (gMain.newKeys & DPAD_DOWN || gMain.newKeys & DPAD_LEFT)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }

        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringExpandPlaceholders(gStringVar4, sDebugText_Util_WarpToMap_SelectWarp);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        gTasks[taskId].data[7] = gTasks[taskId].data[3];
        //WARP
        SetWarpDestinationToMapWarp(gTasks[taskId].data[5], gTasks[taskId].data[6], gTasks[taskId].data[7]); //If not warp with the number available -> center of map
        DoWarp();
        ResetInitialPlayerAvatarState();
        DebugAction_DestroyExtraWindow(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Utilities, sDebugMenu_ListTemplate_Utilities);
    }
}
static void DebugAction_Util_CheckSaveSpace(u8 taskId)
{
    const u32 currSb1Size = (sizeof(struct SaveBlock1));
    const u32 currSb2Size = (sizeof(struct SaveBlock2));
    const u32 currPkmnStorageSize = (sizeof(struct PokemonStorage));
    const u32 maxSb1Size = (SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1));
    const u32 maxSb2Size = SECTOR_DATA_SIZE;
    const u32 maxPkmnStorageSize = (SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1));
    u8* text = &gStringVar4[0x100];
    ConvertIntToDecimalStringN(gStringVar1, currSb1Size, STR_CONV_MODE_LEFT_ALIGN, 6);
    ConvertIntToDecimalStringN(gStringVar2, maxSb1Size, STR_CONV_MODE_LEFT_ALIGN, 6);
    ConvertIntToDecimalStringN(gStringVar3, currSb2Size, STR_CONV_MODE_LEFT_ALIGN, 6);
    text = StringExpandPlaceholders(text, EventScript_Text_CheckSavefileSize_Part1);
    ConvertIntToDecimalStringN(gStringVar1, maxSb2Size, STR_CONV_MODE_LEFT_ALIGN, 6);
    ConvertIntToDecimalStringN(gStringVar2, currPkmnStorageSize, STR_CONV_MODE_LEFT_ALIGN, 6);
    ConvertIntToDecimalStringN(gStringVar3, maxPkmnStorageSize, STR_CONV_MODE_LEFT_ALIGN, 6);
    StringExpandPlaceholders(text, EventScript_Text_CheckSavefileSize_Part2);
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(EventScript_CheckSavefileSize);
}
static void DebugAction_Util_CheckWallClock(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(PlayersHouse_2F_EventScript_CheckWallClock);
}
static void DebugAction_Util_SetWallClock(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(PlayersHouse_2F_EventScript_SetWallClock);
}
static void DebugAction_Util_CheckWeekDay(u8 taskId)
{
    //GetCurrentDayString();
    //Debug_DestroyMenu(taskId);
    //ScriptContext2_Enable();
    //ScriptContext1_SetupScript(EventScript_GetCurrentDay);
    //EnableBothScriptContexts();
}
static void DebugAction_Util_WatchCredits(u8 taskId)
{
    struct Task* task = &gTasks[taskId];
    Debug_DestroyMenu(taskId, TRUE);
    SetMainCallback2(CB2_StartCreditsSequence);
}
// static void DebugAction_Util_Trainer_Name(u8 taskId)
// {
//     NewGameBirchSpeech_SetDefaultPlayerName(Random() % 20);
//     DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldContinueScript);
// }
// static void DebugAction_Util_Rival_Name(u8 taskId)
// {
//     DoNamingScreen(NAMING_SCREEN_RIVAL, gSaveBlock2Ptr->rivalName, 0, 0, 0, CB2_ReturnToFieldContinueScript);
// }
static void DebugAction_Util_Trainer_Gender(u8 taskId)
{
    if (gSaveBlock2Ptr->playerGender == 0) // 0 Male, 1 Female
        gSaveBlock2Ptr->playerGender = 1;
    else
        gSaveBlock2Ptr->playerGender = 0;
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gSaveBlock1Ptr->pos.x, gSaveBlock1Ptr->pos.y);
    DoWarp();
}
static void DebugAction_Util_Trainer_Id(u8 taskId)
{
    u32 trainerId = ((Random() << 16) | Random());
    SetTrainerId(trainerId, gSaveBlock2Ptr->playerTrainerId);
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}
//static void DebugAction_Util_CheckEVs(u8 taskId)
//{
//    Debug_DestroyMenu(taskId, TRUE);
//    ScriptContext2_Enable();
//    ScriptContext1_SetupScript(EventScript_CheckEVs);
//}
//static void DebugAction_Util_CheckIVs(u8 taskId)
//{
//    Debug_DestroyMenu(taskId, TRUE);
//    ScriptContext2_Enable();
//    ScriptContext1_SetupScript(EventScript_CheckIVs);
//}
static void DebugAction_Util_ForceEggHatch(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(EventScript_ForceEggHatch);
}
static void DebugAction_Util_OpenPC(u8 taskId)
{
    gIsFromPhone = TRUE;
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(EventScript_PC);
}
static void DebugAction_Util_DoWonderTrade(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    ScriptContext2_Enable();
    ScriptContext1_SetupScript(EventScript_DoWonderTrade);
}
// static void DebugAction_Util_ChangeCostume(u8 taskId)
// {
//     if (gSaveBlock2Ptr->costumeId == 0)
//         VarSet(VAR_TEMP_1, 1);
//     else if (gSaveBlock2Ptr->costumeId == 1)
//         VarSet(VAR_TEMP_1, 2);
//     else
//         VarSet(VAR_TEMP_1, 0);

//     FadeScreen(FADE_TO_BLACK, 0);
//     gTasks[taskId].func = DebugTask_ChangeCostume_Execute;
// }
// static void DebugTask_ChangeCostume_Execute(u8 taskId)
// {
//     if (!gPaletteFade.active)
//     {
//         SwapPlayersCostume();
//         gTasks[taskId].func = DebugTask_ChangeCostume_End;
//     }
// }
//static void DebugTask_ChangeCostume_End(u8 taskId)
//{
//    if (!gPaletteFade.active)
//    {
//        FadeInFromBlack();
//        Debug_DestroyMenu(taskId, TRUE);
//        EnableBothScriptContexts();
//    }
//}
//static void DebugAction_Util_CatchChainStatus(u8 taskId)
//{
//    Debug_DestroyMenu(taskId, TRUE);
//    ScriptContext2_Enable();
//    ScriptContext1_SetupScript(Script_CatchingStreak);
//}
static void DebugAction_Util_CreateDaycareEgg(u8 taskId)
{
    if (CountPokemonInDaycare(&gSaveBlock1Ptr->daycare) == DAYCARE_MON_COUNT)
        TriggerPendingDaycareEgg();
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}
// static void DebugAction_Util_ClearBag(u8 taskId)
// {
//     int i;

//     ClearBag();
//     for (i = 0; i < BAG_TMHM_COUNT; ++i)
//         gSaveBlock1Ptr->bagPocket_TMHMOwnedFlags[i / 8] = 0;
//     Debug_DestroyMenu(taskId);
//     EnableBothScriptContexts();
// }
static void DebugAction_Util_ClearParty(u8 taskId)
{
    ZeroPlayerPartyMons();
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}

// *******************************
// Actions Flags
static void DebugAction_Flags_Flags(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial Flag
    ConvertIntToDecimalStringN(gStringVar1, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS);
    ConvertIntToHexStringN(gStringVar2, 0, STR_CONV_MODE_LEFT_ALIGN, 3);
    StringExpandPlaceholders(gStringVar1, sDebugText_FlagHex);
    if (FlagGet(0) == TRUE)
        StringCopyPadded(gStringVar2, sDebugText_FlagSet, CHAR_SPACE, 15);
    else
        StringCopyPadded(gStringVar2, sDebugText_FlagUnset, CHAR_SPACE, 15);
    StringCopy(gStringVar3, gText_DigitIndicator[0]);
    StringExpandPlaceholders(gStringVar4, sDebugText_Flag);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    gTasks[taskId].func = DebugAction_Flags_FlagsSelect;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 0;            //Current Flag
    gTasks[taskId].data[4] = 0;            //Digit Selected
}
static void DebugAction_Flags_FlagsSelect(u8 taskId)
{
    if (gMain.newKeys & A_BUTTON)
        FlagToggle(gTasks[taskId].data[3]);
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Flags, sDebugMenu_ListTemplate_Flags);
        return;
    }

    if (gMain.newKeys & DPAD_UP)
    {
        PlaySE(SE_SELECT);
        gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
        if (gTasks[taskId].data[3] >= FLAGS_COUNT){
            gTasks[taskId].data[3] = FLAGS_COUNT - 1;
        }
    }
    if (gMain.newKeys & DPAD_DOWN)
    {
        PlaySE(SE_SELECT);
        gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
        if (gTasks[taskId].data[3] < 0){
            gTasks[taskId].data[3] = 0;
        }
    }
    if (gMain.newKeys & DPAD_LEFT)
    {
        PlaySE(SE_SELECT);
        gTasks[taskId].data[4] -= 1;
        if (gTasks[taskId].data[4] < 0)
        {
            gTasks[taskId].data[4] = 0;
        }
    }
    if (gMain.newKeys & DPAD_RIGHT)
    {
        PlaySE(SE_SELECT);
        gTasks[taskId].data[4] += 1;
        if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_FLAGS-1)
        {
            gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_FLAGS-1;
        }
    }

    if (gMain.newKeys & DPAD_ANY || gMain.newKeys & A_BUTTON)
    {
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_FLAGS);
        ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 3);
        StringExpandPlaceholders(gStringVar1, sDebugText_FlagHex);
        if (FlagGet(gTasks[taskId].data[3]) == TRUE)
            StringCopyPadded(gStringVar2, sDebugText_FlagSet, CHAR_SPACE, 15);
        else
            StringCopyPadded(gStringVar2, sDebugText_FlagUnset, CHAR_SPACE, 15);
        StringCopy(gStringVar3, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringExpandPlaceholders(gStringVar4, sDebugText_Flag);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }
}

static void DebugAction_Flags_SetPokedexFlags(u8 taskId)
{
    u16 i;
    for (i = 0; i < NATIONAL_DEX_COUNT; i++)
    {
        GetSetPokedexFlag(i + 1, FLAG_SET_CAUGHT);
        GetSetPokedexFlag(i + 1, FLAG_SET_SEEN);
    }
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}
static void DebugAction_Flags_SwitchDex(u8 taskId)
{
    if (FlagGet(FLAG_SYS_POKEDEX_GET))
    {
        FlagClear(FLAG_SYS_POKEDEX_GET);
        PlaySE(SE_PC_OFF);
    }
    else
    {
        FlagSet(FLAG_SYS_POKEDEX_GET);
        PlaySE(SE_PC_LOGIN);
    }
}
static void DebugAction_Flags_SwitchNatDex(u8 taskId)
{
    if (IsNationalPokedexEnabled())
    {
        DisableNationalPokedex();
        PlaySE(SE_PC_OFF);
    }
    else
    {
        EnableNationalPokedex();
        PlaySE(SE_PC_LOGIN);
    }
}
static void DebugAction_Flags_SwitchPokemon(u8 taskId)
{
    if (FlagGet(FLAG_SYS_POKEMON_GET))
    {
        FlagClear(FLAG_SYS_POKEMON_GET);
        PlaySE(SE_PC_OFF);
    }
    else
    {
        FlagSet(FLAG_SYS_POKEMON_GET);
        PlaySE(SE_PC_LOGIN);
    }
}
static void DebugAction_Flags_SwitchPokeNav(u8 taskId)
{
    if (FlagGet(FLAG_SYS_POKENAV_GET))
    {
        FlagClear(FLAG_SYS_POKENAV_GET);
        PlaySE(SE_PC_OFF);
    }
    else
    {
        FlagSet(FLAG_SYS_POKENAV_GET);
        PlaySE(SE_PC_LOGIN);
    }
}
static void DebugAction_Flags_ToggleFlyFlags(u8 taskId)
{
    // Sound effect
    if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER))
        PlaySE(SE_PC_OFF);
    else
        PlaySE(SE_PC_LOGIN);
    FlagToggle(FLAG_VISITED_LITTLEROOT_TOWN);
    FlagToggle(FLAG_VISITED_OLDALE_TOWN);
    FlagToggle(FLAG_VISITED_DEWFORD_TOWN);
    FlagToggle(FLAG_VISITED_LAVARIDGE_TOWN);
    FlagToggle(FLAG_VISITED_FALLARBOR_TOWN);
    FlagToggle(FLAG_VISITED_VERDANTURF_TOWN);
    FlagToggle(FLAG_VISITED_PACIFIDLOG_TOWN);
    FlagToggle(FLAG_VISITED_PETALBURG_CITY);
    FlagToggle(FLAG_VISITED_SLATEPORT_CITY);
    FlagToggle(FLAG_VISITED_MAUVILLE_CITY);
    FlagToggle(FLAG_VISITED_RUSTBORO_CITY);
    FlagToggle(FLAG_VISITED_FORTREE_CITY);
    FlagToggle(FLAG_VISITED_LILYCOVE_CITY);
    FlagToggle(FLAG_VISITED_MOSSDEEP_CITY);
    FlagToggle(FLAG_VISITED_SOOTOPOLIS_CITY);
    FlagToggle(FLAG_VISITED_EVER_GRANDE_CITY);
    FlagToggle(FLAG_LANDMARK_POKEMON_LEAGUE);
    FlagToggle(FLAG_LANDMARK_BATTLE_FRONTIER);
}
static void DebugAction_Flags_ToggleBadgeFlags(u8 taskId)
{
    // Sound effect
    if (FlagGet(FLAG_BADGE08_GET))
        PlaySE(SE_PC_OFF);
    else
        PlaySE(SE_PC_LOGIN);
    FlagToggle(FLAG_BADGE01_GET);
    FlagToggle(FLAG_BADGE02_GET);
    FlagToggle(FLAG_BADGE03_GET);
    FlagToggle(FLAG_BADGE04_GET);
    FlagToggle(FLAG_BADGE05_GET);
    FlagToggle(FLAG_BADGE06_GET);
    FlagToggle(FLAG_BADGE07_GET);
    FlagToggle(FLAG_BADGE08_GET);
}
#define FLAG_DISABLE_COLLISIONS FLAG_ACROSS_WALL
#define FLAG_DISABLE_WILD_ENCOUNTERS FLAG_NO_WILD_MON
#define FLAG_DISABLE_TRAINER_ENCOUNTERS FLAG_INVISIBLE_CLOTHES
#define FLAG_DISABLE_EXPERIENCE FLAG_NONE_EXP

 static void DebugAction_Flags_CollisionOnOff(u8 taskId)
 {
     if (FlagGet(FLAG_DISABLE_COLLISIONS))
     {
         FlagClear(FLAG_DISABLE_COLLISIONS);
         PlaySE(SE_PC_OFF);
     }
     else
     {
         FlagSet(FLAG_DISABLE_COLLISIONS);
         PlaySE(SE_PC_LOGIN);
     }
 }
 static void DebugAction_Flags_EncounterOnOff(u8 taskId)
 {
     if (FlagGet(FLAG_DISABLE_WILD_ENCOUNTERS))
     {
         FlagClear(FLAG_DISABLE_WILD_ENCOUNTERS);
         PlaySE(SE_PC_OFF);
     }
     else
     {
         FlagSet(FLAG_DISABLE_WILD_ENCOUNTERS);
         PlaySE(SE_PC_LOGIN);
     }
 }
 static void DebugAction_Flags_TrainerSeeOnOff(u8 taskId)
 {
     if (FlagGet(FLAG_DISABLE_TRAINER_ENCOUNTERS))
     {
         FlagClear(FLAG_DISABLE_TRAINER_ENCOUNTERS);
         PlaySE(SE_PC_OFF);
     }
     else
     {
         FlagSet(FLAG_DISABLE_TRAINER_ENCOUNTERS);
         PlaySE(SE_PC_LOGIN);
     }
 }
// static void DebugAction_Flags_BagUseOnOff(u8 taskId)
// {
//     if (FlagGet(FLAG_DISABLE_BATTLE_BAG_ACCESS))
//     {
//         FlagClear(FLAG_DISABLE_BATTLE_BAG_ACCESS);
//         PlaySE(SE_PC_OFF);
//     }
//     else
//     {
//         FlagSet(FLAG_DISABLE_BATTLE_BAG_ACCESS);
//         PlaySE(SE_PC_LOGIN);
//     }
// }
// static void DebugAction_Flags_CatchingOnOff(u8 taskId)
// {
//     if (FlagGet(FLAG_DISABLE_BALL_THROWS))
//     {
//         FlagClear(FLAG_DISABLE_BALL_THROWS);
//         PlaySE(SE_PC_OFF);
//     }
//     else
//     {
//         FlagSet(FLAG_DISABLE_BALL_THROWS);
//         PlaySE(SE_PC_LOGIN);
//     }
// }
// static void DebugAction_Flags_ShiniesOnOff(u8 taskId)
// {
//     if (FlagGet(FLAG_FORCE_SHINIES))
//     {
//         FlagClear(FLAG_FORCE_SHINIES);
//         PlaySE(SE_PC_OFF);
//     }
//     else
//     {
//         FlagSet(FLAG_FORCE_SHINIES);
//         PlaySE(SE_PC_LOGIN);
//     }
// }
// static void DebugAction_Flags_EscapingOnOff(u8 taskId)
// {
//     if (FlagGet(FLAG_DISABLE_ESCAPING_FROM_BATTLE))
//     {
//         FlagClear(FLAG_DISABLE_ESCAPING_FROM_BATTLE);
//         PlaySE(SE_PC_OFF);
//     }
//     else
//     {
//         FlagSet(FLAG_DISABLE_ESCAPING_FROM_BATTLE);
//         PlaySE(SE_PC_LOGIN);
//     }
// }
 static void DebugAction_Flags_ExperienceOnOff(u8 taskId)
 {
     if (FlagGet(FLAG_DISABLE_EXPERIENCE))
     {
         FlagClear(FLAG_DISABLE_EXPERIENCE);
         PlaySE(SE_PC_OFF);
     }
     else
     {
         FlagSet(FLAG_DISABLE_EXPERIENCE);
         PlaySE(SE_PC_LOGIN);
     }
 }
 static void DebugAction_Flags_RandomOnOff(u8 taskId)
 {
     if (!FlagGet(FLAG_IS_RANDOM_MODE))
     {
         FlagSet(FLAG_IS_RANDOM_MODE);
         PlaySE(SE_PC_LOGIN);
     }
     else if (!FlagGet(FLAG_ABS_RANDOM_MODE))
     {
         FlagSet(FLAG_ABS_RANDOM_MODE);
         PlaySE(SE_PC_LOGIN);
     }
     else
     {
         FlagClear(FLAG_IS_RANDOM_MODE);
         FlagClear(FLAG_ABS_RANDOM_MODE);
         PlaySE(SE_PC_OFF);
     }
 }

static void fn(u16 flag)
{
    if (FlagToggle(flag))
    {
        PlaySE(SE_PC_OFF);
    }
    else
    {
        PlaySE(SE_PC_LOGIN);
    }
}

 static void DebugAction_Flags_TeamRocketOnOff(u8 taskId)
 {
     fn(FLAG_TEAM_ROCKET_MODE);
 }

 static void DebugAction_Flags_NuzlockeModeOnOff(u8 taskId)
 {
     fn(FLAG_NUZLOCKE_MODE);
 }

 static void DebugAction_Flags_BrightRayOnOff(u8 taskId)
 {
     fn(FLAG_BRIGHT_RAY_MODE);
 }

 static void DebugAction_Flags_DoubleBattle(u8 taskId)
 {
     fn(FLAG_DOUBLE_WILD_BATTLE);
 }

// static void DebugAction_Flags_ShinyHueShiftOnOff(u8 taskId)
// {
//     if (FlagGet(FLAG_DISABLE_SHINY_HUE_SHIFT))
//     {
//         FlagClear(FLAG_DISABLE_SHINY_HUE_SHIFT);
//         PlaySE(SE_PC_OFF);
//     }
//     else
//     {
//         FlagSet(FLAG_DISABLE_SHINY_HUE_SHIFT);
//         PlaySE(SE_PC_LOGIN);
//     }
// }
// *******************************
// Actions Variables
static void DebugAction_Vars_Vars(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial Variable
    ConvertIntToDecimalStringN(gStringVar1, VARS_START, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
    ConvertIntToHexStringN(gStringVar2, VARS_START, STR_CONV_MODE_LEFT_ALIGN, 4);
    StringExpandPlaceholders(gStringVar1, sDebugText_VariableHex);
    ConvertIntToDecimalStringN(gStringVar3, 0, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
    StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    StringExpandPlaceholders(gStringVar4, sDebugText_Variable);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    gTasks[taskId].func = DebugAction_Vars_Select;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = VARS_START;            //Current Variable
    gTasks[taskId].data[4] = 0;            //Digit Selected
    gTasks[taskId].data[5] = 0;            //Current Variable VALUE
}

static void DebugAction_Vars_Select(u8 taskId)
{
    if (gMain.newKeys & DPAD_UP)
    {
        gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
        if (gTasks[taskId].data[3] > VARS_END){
            gTasks[taskId].data[3] = VARS_END;
        }
    }
    if (gMain.newKeys & DPAD_DOWN)
    {
        gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
        if (gTasks[taskId].data[3] < VARS_START){
            gTasks[taskId].data[3] = VARS_START;
        }
    }
    if (gMain.newKeys & DPAD_LEFT)
    {
        gTasks[taskId].data[4] -= 1;
        if (gTasks[taskId].data[4] < 0)
        {
            gTasks[taskId].data[4] = 0;
        }
    }
    if (gMain.newKeys & DPAD_RIGHT)
    {
        gTasks[taskId].data[4] += 1;
        if (gTasks[taskId].data[4] > DEBUG_NUMBER_DIGITS_VARIABLES-1)
        {
            gTasks[taskId].data[4] = DEBUG_NUMBER_DIGITS_VARIABLES-1;
        }
    }

    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4);
        StringExpandPlaceholders(gStringVar1, sDebugText_VariableHex);
        if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value, if 65535 the value hasnt been set
            gTasks[taskId].data[5] = 0;
        else
            gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit

        //Combine str's to full window string
        StringExpandPlaceholders(gStringVar4, sDebugText_Variable);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        gTasks[taskId].data[4] = 0;

        PlaySE(SE_SELECT);

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4);
        StringExpandPlaceholders(gStringVar1, sDebugText_VariableHex);
        if (VarGetIfExist(gTasks[taskId].data[3]) == 65535) //Current value if 65535 the value hasnt been set
            gTasks[taskId].data[5] = 0;
        else
            gTasks[taskId].data[5] = VarGet(gTasks[taskId].data[3]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[5], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit
        StringExpandPlaceholders(gStringVar4, sDebugText_VariableValueSet);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].data[6] = gTasks[taskId].data[5]; //New value selector
        gTasks[taskId].func = DebugAction_Vars_SetValue;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars);
        return;
    }
}
static void DebugAction_Vars_SetValue(u8 taskId)
{
    if (gMain.newKeys & DPAD_UP)
    {
        if (gTasks[taskId].data[6] + sPowersOfTen[gTasks[taskId].data[4]] <= 32000)
            gTasks[taskId].data[6] += sPowersOfTen[gTasks[taskId].data[4]];
        else
            gTasks[taskId].data[6] = 32000-1;
        if (gTasks[taskId].data[6] >= 32000){
            gTasks[taskId].data[6] = 32000-1;
        }
    }
    if (gMain.newKeys & DPAD_DOWN)
    {
        gTasks[taskId].data[6] -= sPowersOfTen[gTasks[taskId].data[4]];
        if (gTasks[taskId].data[6] < 0){
            gTasks[taskId].data[6] = 0;
        }
    }
    if (gMain.newKeys & DPAD_LEFT)
    {
        gTasks[taskId].data[4] -= 1;
        if (gTasks[taskId].data[4] < 0)
        {
            gTasks[taskId].data[4] = 0;
        }
    }
    if (gMain.newKeys & DPAD_RIGHT)
    {
        gTasks[taskId].data[4] += 1;
        if (gTasks[taskId].data[4] > 4)
        {
            gTasks[taskId].data[4] = 4;
        }
    }

    if (gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);
        VarSet(gTasks[taskId].data[3], gTasks[taskId].data[6]);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Vars, sDebugMenu_ListTemplate_Vars);
        return;
    }

    if (gMain.newKeys & DPAD_ANY || gMain.newKeys & A_BUTTON)
    {
        PlaySE(SE_SELECT);

        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        ConvertIntToHexStringN(gStringVar2, gTasks[taskId].data[3], STR_CONV_MODE_LEFT_ALIGN, 4);
        StringExpandPlaceholders(gStringVar1, sDebugText_VariableHex);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[6], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_VARIABLES);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]); //Current digit
        StringExpandPlaceholders(gStringVar4, sDebugText_VariableValueSet);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }
}

// *******************************
// Actions Give
#define ITEM_TAG 0xFDF3
static void DebugAction_Give_Item(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
    CopyItemName(1, gStringVar1);
    StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
    StringExpandPlaceholders(gStringVar4, sDebugText_ItemID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    gTasks[taskId].func = DebugAction_Give_Item_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 1;                         //Current ID
    gTasks[taskId].data[4] = 0;                         //Digit Selected
    gTasks[taskId].data[5] = gTasks[taskId].data[3];    //Last song played (for stopping)
    gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]);
    gSprites[gTasks[taskId].data[6]].pos2.x = DEBUG_NUMBER_ICON_X+10;
    gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10;
    gSprites[gTasks[taskId].data[6]].oam.priority = 0;
}
static void DebugAction_Give_Item_SelectId(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] >= ITEMS_COUNT)
                gTasks[taskId].data[3] = ITEMS_COUNT - 1;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        CopyItemName(gTasks[taskId].data[3], gStringVar1);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
        StringExpandPlaceholders(gStringVar4, sDebugText_ItemID);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        FreeSpriteTilesByTag(ITEM_TAG);                         //Destroy item icon
        FreeSpritePaletteByTag(ITEM_TAG);                       //Destroy item icon
        FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon
        DestroySprite(&gSprites[gTasks[taskId].data[6]]);       //Destroy item icon
        gTasks[taskId].data[6] = AddItemIconSprite(ITEM_TAG, ITEM_TAG, gTasks[taskId].data[3]);
        gSprites[gTasks[taskId].data[6]].pos2.x = DEBUG_NUMBER_ICON_X+10;
        gSprites[gTasks[taskId].data[6]].pos2.y = DEBUG_NUMBER_ICON_Y+10;
        gSprites[gTasks[taskId].data[6]].oam.priority = 0;
    }

    if (gMain.newKeys & A_BUTTON)
    {
        gTasks[taskId].data[5] = gTasks[taskId].data[3];
        gTasks[taskId].data[3] = 1;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_ItemQuantity);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Give_Item_SelectQuantity;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        FreeSpriteTilesByTag(ITEM_TAG);                         //Destroy item icon
        FreeSpritePaletteByTag(ITEM_TAG);                       //Destroy item icon
        FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon
        DestroySprite(&gSprites[gTasks[taskId].data[6]]);       //Destroy item icon

        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Item_SelectQuantity(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] >= 100)
                gTasks[taskId].data[3] = 99;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 2)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEM_QUANTITY);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_ItemQuantity);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        FreeSpriteTilesByTag(ITEM_TAG);                         //Destroy item icon
        FreeSpritePaletteByTag(ITEM_TAG);                       //Destroy item icon
        FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon
        DestroySprite(&gSprites[gTasks[taskId].data[6]]);       //Destroy item icon

        PlaySE(MUS_OBTAIN_ITEM);
        AddBagItem(gTasks[taskId].data[5], gTasks[taskId].data[3]);
        DebugAction_DestroyExtraWindow(taskId);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        FreeSpriteTilesByTag(ITEM_TAG);                         //Destroy item icon
        FreeSpritePaletteByTag(ITEM_TAG);                       //Destroy item icon
        FreeSpriteOamMatrix(&gSprites[gTasks[taskId].data[6]]); //Destroy item icon
        DestroySprite(&gSprites[gTasks[taskId].data[6]]);       //Destroy item icon

        PlaySE(SE_SELECT);
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}

//TMs
static void DebugAction_Give_AllTMs(u8 taskId)
{
    u16 i;
    PlayFanfare(MUS_OBTAIN_TMHM);
    for (i = ITEM_TM01; i <= ITEM_HM08; i++)
        if (!CheckBagHasItem(i, 1))
            AddBagItem(i, 1);
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}

//Pokemon
static void ResetMonDataStruct(struct DebugMonData *sDebugMonData)
{
    sDebugMonData->mon_speciesId    = 1;
    sDebugMonData->mon_level        = 1;
    sDebugMonData->isShiny          = 0;
    sDebugMonData->mon_natureId     = 0;
    sDebugMonData->mon_abilityNum   = 0;
    sDebugMonData->mon_iv_hp        = 0;
    sDebugMonData->mon_iv_atk       = 0;
    sDebugMonData->mon_iv_def       = 0;
    sDebugMonData->mon_iv_speed     = 0;
    sDebugMonData->mon_iv_satk      = 0;
    sDebugMonData->mon_iv_sdef      = 0;
}

//Egg
static void DebugAction_Give_Egg(u8 taskId)
{
    u8 windowId;

    //Mon data struct
    sDebugMonData = AllocZeroed(sizeof(struct DebugMonData));
    ResetMonDataStruct(sDebugMonData);

    //Window initialization
    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 3);
    StringCopy(gStringVar1, gSpeciesNames[1]);
    StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
    StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    //Set task data
    gTasks[taskId].func = DebugAction_Give_Egg_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 1;            //Current ID
    gTasks[taskId].data[4] = 0;            //Digit Selected
    gTasks[taskId].data[5] = 0;            //Complex?
    FreeMonIconPalettes();                 //Free space for new pallete
    LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon
    #ifndef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
    #endif
    #ifdef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
    #endif
    gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID
}
static void DebugAction_Give_Egg_SelectId(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > SPECIES_CELEBI && gTasks[taskId].data[3] < SPECIES_TREECKO)
                gTasks[taskId].data[3] = SPECIES_TREECKO;
            if (gTasks[taskId].data[3] >= NUM_SPECIES)
                gTasks[taskId].data[3] = NUM_SPECIES - 1;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < SPECIES_TREECKO && gTasks[taskId].data[3] > SPECIES_CELEBI)
                gTasks[taskId].data[3] = SPECIES_CELEBI;
            if (gTasks[taskId].data[3] < 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]);
        FreeMonIconPalettes(); //Free space for new pallete
        LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon
        #ifndef POKEMON_EXPANSION
            gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
        #endif
        #ifdef POKEMON_EXPANSION
            gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
        #endif
        gSprites[gTasks[taskId].data[6]].oam.priority = 0;
    }

    if (gMain.newKeys & A_BUTTON)
    {
        sDebugMonData->mon_speciesId = gTasks[taskId].data[3]; //Species ID
        gTasks[taskId].data[3] = 1;
        gTasks[taskId].data[4] = 0;

        FreeMonIconPalettes();
        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite
        if (gTasks[taskId].data[5] == 0)
        {
            PlaySE(MUS_LEVEL_UP);
            ScriptGiveEgg(sDebugMonData->mon_speciesId);
            Free(sDebugMonData); //Frees EWRAM of MonData Struct
            DebugAction_DestroyExtraWindow(taskId);
        }
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        FreeMonIconPalettes();
        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_PokemonSimple(u8 taskId)
{
    u8 windowId;

    //Mon data struct
    sDebugMonData = AllocZeroed(sizeof(struct DebugMonData));
    ResetMonDataStruct(sDebugMonData);

    //Window initialization
    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4);
    StringCopy(gStringVar1, gSpeciesNames[1]);
    StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
    StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    //Set task data
    gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 1;            //Current ID
    gTasks[taskId].data[4] = 0;            //Digit Selected
    gTasks[taskId].data[5] = 0;            //Complex?
    FreeMonIconPalettes();                 //Free space for new pallete
    LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon
    #ifndef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
    #endif
    #ifdef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
    #endif
    gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID
}
static void DebugAction_Give_PokemonComplex(u8 taskId)
{
    u8 windowId;

    //Mon data struct
    sDebugMonData = AllocZeroed(sizeof(struct DebugMonData));
    ResetMonDataStruct(sDebugMonData);

    //Window initialization
    ClearStdWindowAndFrame(gTasks[taskId].data[1], FALSE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, 4);
    StringCopy(gStringVar1, gSpeciesNames[1]);
    StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
    StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);


    gTasks[taskId].func = DebugAction_Give_Pokemon_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 1;            //Current ID
    gTasks[taskId].data[4] = 0;            //Digit Selected
    gTasks[taskId].data[5] = 1;            //Complex?
    FreeMonIconPalettes();                 //Free space for new palletes
    LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon
    #ifndef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
    #endif
    #ifdef POKEMON_EXPANSION
        gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
    #endif
    gSprites[gTasks[taskId].data[6]].oam.priority = 0; //Mon Icon ID
    gTasks[taskId].data[7] = 0;             //iterator
}

static void DebugAction_Give_Pokemon_SelectId(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > SPECIES_CELEBI && gTasks[taskId].data[3] < SPECIES_TREECKO)
                gTasks[taskId].data[3] = SPECIES_TREECKO;
            if (gTasks[taskId].data[3] >= NUM_SPECIES)
                gTasks[taskId].data[3] = NUM_SPECIES - 1;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < SPECIES_TREECKO && gTasks[taskId].data[3] > SPECIES_CELEBI)
                gTasks[taskId].data[3] = SPECIES_CELEBI;
            if (gTasks[taskId].data[3] < 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringCopy(gStringVar1, gSpeciesNames[gTasks[taskId].data[3]]); //CopyItemName(gTasks[taskId].data[3], gStringVar1);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 4);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonID);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]);
        FreeMonIconPalettes(); //Free space for new pallete
        LoadMonIconPalette(gTasks[taskId].data[3]); //Loads pallete for current mon
        #ifndef POKEMON_EXPANSION
            gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0, TRUE); //Create pokemon sprite
        #endif
        #ifdef POKEMON_EXPANSION
            gTasks[taskId].data[6] = CreateMonIcon(gTasks[taskId].data[3], SpriteCB_MonIcon, DEBUG_NUMBER_ICON_X, DEBUG_NUMBER_ICON_Y, 4, 0); //Create pokemon sprite
        #endif
        gSprites[gTasks[taskId].data[6]].oam.priority = 0;
    }

    if (gMain.newKeys & A_BUTTON)
    {
        sDebugMonData->mon_speciesId = gTasks[taskId].data[3]; //Species ID
        gTasks[taskId].data[3] = 1;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonLevel);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Give_Pokemon_SelectLevel;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        FreeMonIconPalettes();
        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_SelectLevel(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > MAX_LEVEL)
                gTasks[taskId].data[3] = MAX_LEVEL;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < MIN_LEVEL)
                gTasks[taskId].data[3] = MIN_LEVEL;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 2)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar1, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonLevel);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        FreeMonIconPalettes();
        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite
        if (gTasks[taskId].data[5] == 0)
        {
            PlaySE(MUS_LEVEL_UP);
            ScriptGiveMon(sDebugMonData->mon_speciesId, gTasks[taskId].data[3], ITEM_NONE, 0,0,0);
            Free(sDebugMonData); //Frees EWRAM of MonData Struct
            DebugAction_DestroyExtraWindow(taskId);
        }
        else
        {
            sDebugMonData->mon_level = gTasks[taskId].data[3]; //Level
            gTasks[taskId].data[3] = 0;
            gTasks[taskId].data[4] = 0;

            ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0);
            StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
            StringCopyPadded(gStringVar2, sDebugText_FlagUnset, CHAR_SPACE, 15);
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny);
            _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

            gTasks[taskId].func = DebugAction_Give_Pokemon_SelectShiny;
        }
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        FreeMonIconPalettes();
        FreeAndDestroyMonIconSprite(&gSprites[gTasks[taskId].data[6]]); //Destroy pokemon sprite
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
//If complex
static void DebugAction_Give_Pokemon_SelectShiny(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP || gMain.newKeys & DPAD_RIGHT)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_DOWN || gMain.newKeys & DPAD_LEFT)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }

        if (gTasks[taskId].data[3] == 1)
            StringCopyPadded(gStringVar2, sDebugText_FlagSet, CHAR_SPACE, 15);
        else
            StringCopyPadded(gStringVar2, sDebugText_FlagUnset, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 0);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonShiny);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        sDebugMonData->isShiny = gTasks[taskId].data[3]; //isShiny
        gTasks[taskId].data[3] = 0;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringCopy(gStringVar1, gNatureNamePointers[0]);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonNature);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Give_Pokemon_SelectNature;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_SelectNature(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP || gMain.newKeys & DPAD_RIGHT)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > NUM_NATURES-1)
                gTasks[taskId].data[3] = NUM_NATURES-1;
        }
        if (gMain.newKeys & DPAD_DOWN || gMain.newKeys & DPAD_LEFT)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringCopy(gStringVar1, gNatureNamePointers[gTasks[taskId].data[3]]);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonNature);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        u8 abilityId;
        sDebugMonData->mon_natureId = gTasks[taskId].data[3]; //NatureId
        gTasks[taskId].data[3] = 0;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, 0);
        StringCopy(gStringVar1, gAbilityNames[abilityId]);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonAbility);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Give_Pokemon_SelectAbility;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_SelectAbility(u8 taskId)
{
    u16 abilityId;
//    u8 abilityCount = 0;
    const register u8 abilityCount = 2;

//    if (gBaseStats[sDebugMonData->mon_speciesId].abilities[1] != ABILITY_NONE)
//        abilityCount++;
//    if (gBaseStats[sDebugMonData->mon_speciesId].abilityHidden != ABILITY_NONE)
//        abilityCount++;
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP || gMain.newKeys & DPAD_RIGHT)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > abilityCount)
                gTasks[taskId].data[3] = abilityCount;
        }
        if (gMain.newKeys & DPAD_DOWN || gMain.newKeys & DPAD_LEFT)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }

        abilityId = GetAbilityBySpecies(sDebugMonData->mon_speciesId, gTasks[taskId].data[3]);
        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringCopy(gStringVar1, gAbilityNames[abilityId]);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonAbility);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        sDebugMonData->mon_abilityNum = gTasks[taskId].data[3]; //AbilityNum
        gTasks[taskId].data[3] = 0;
        gTasks[taskId].data[4] = 0;

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

        gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs;
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_SelectIVs(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > 31)
                gTasks[taskId].data[3] = 31;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 2)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
        StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
        switch (gTasks[taskId].data[7])
        {
        case 0:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0);
            break;
        case 1:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_1);
            break;
        case 2:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_2);
            break;
        case 3:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_3);
            break;
        case 4:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_4);
            break;
        case 5:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_5);
            break;
        }
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    //If A or B button
    if (gMain.newKeys & A_BUTTON)
    {
        switch (gTasks[taskId].data[7])
        {
        case 0:
            sDebugMonData->mon_iv_hp = gTasks[taskId].data[3];
            break;
        case 1:
            sDebugMonData->mon_iv_atk = gTasks[taskId].data[3];
            break;
        case 2:
            sDebugMonData->mon_iv_def = gTasks[taskId].data[3];
            break;
        case 3:
            sDebugMonData->mon_iv_speed = gTasks[taskId].data[3];
            break;
        case 4:
            sDebugMonData->mon_iv_satk = gTasks[taskId].data[3];
            break;
        case 5:
            sDebugMonData->mon_iv_sdef = gTasks[taskId].data[3];
            break;
        }

        //Check if all IVs set
        if (gTasks[taskId].data[7] != 5)
        {
            gTasks[taskId].data[7] += 1;
            gTasks[taskId].data[3] = 0;
            gTasks[taskId].data[4] = 0;

            StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
            ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 2);
            StringCopyPadded(gStringVar3, gStringVar3, CHAR_SPACE, 15);
            switch (gTasks[taskId].data[7])
            {
            case 0:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_0);
                break;
            case 1:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_1);
                break;
            case 2:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_2);
                break;
            case 3:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_3);
                break;
            case 4:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_4);
                break;
            case 5:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonIV_5);
                break;
            }
            _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

            gTasks[taskId].func = DebugAction_Give_Pokemon_SelectIVs;
        }
        else
        {
            gTasks[taskId].data[3] = 0;
            gTasks[taskId].data[4] = 0;
            gTasks[taskId].data[7] = 0; //Reset iterator

            StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
            StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]);
            StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
            ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3);
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0);
            _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

            gTasks[taskId].func = DebugAction_Give_Pokemon_Move;
        }
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_Move(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        PlaySE(SE_SELECT);

        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > MOVES_COUNT)
                gTasks[taskId].data[3] = MOVES_COUNT;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 0)
                gTasks[taskId].data[3] = 0;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < 3)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]);
        StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3);
        switch (gTasks[taskId].data[7])
        {
        case 0:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0);
            break;
        case 1:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_1);
            break;
        case 2:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_2);
            break;
        case 3:
            StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_3);
            break;
        }
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        //If MOVE_NONE selected, stop asking for additional moves
        if (gTasks[taskId].data[3] == 0)
            gTasks[taskId].data[7] = 4;

        //Set current value
        switch (gTasks[taskId].data[7])
        {
        case 0:
            sDebugMonData->mon_move_0 = gTasks[taskId].data[3];
            break;
        case 1:
            sDebugMonData->mon_move_1 = gTasks[taskId].data[3];
            break;
        case 2:
            sDebugMonData->mon_move_2 = gTasks[taskId].data[3];
            break;
        case 3:
            sDebugMonData->mon_move_3 = gTasks[taskId].data[3];
            break;
        }

        //If NOT last move or selected MOVE_NONE ask for next move, else make mon
        if (gTasks[taskId].data[7] < 3)
        {
            gTasks[taskId].data[7] += 1;
            gTasks[taskId].data[3] = 0;
            gTasks[taskId].data[4] = 0;

            StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
            StringCopy(gStringVar1, gMoveNames[gTasks[taskId].data[3]]);
            StringCopyPadded(gStringVar1, gStringVar1, CHAR_SPACE, 15);
            ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, 3);
            switch (gTasks[taskId].data[7])
            {
            case 0:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_0);
                break;
            case 1:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_1);
                break;
            case 2:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_2);
                break;
            case 3:
                StringExpandPlaceholders(gStringVar4, sDebugText_PokemonMove_3);
                break;
            }
            _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);

            gTasks[taskId].func = DebugAction_Give_Pokemon_Move;
        }
        else
        {
            gTasks[taskId].data[3] = 0;
            gTasks[taskId].data[4] = 0;

            PlaySE(MUS_LEVEL_UP);
            gTasks[taskId].func = DebugAction_Give_Pokemon_ComplexCreateMon;
        }
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        Free(sDebugMonData); //Frees EWRAM of MonData Struct
        Debug_DestroyMenu(taskId, FALSE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
    }
}
static void DebugAction_Give_Pokemon_ComplexCreateMon(u8 taskId) //https://github.com/ghoulslash/pokeemerald/tree/custom-givemon
{
    u16 nationalDexNum;
    int sentToPc;
    struct Pokemon mon;
    u8 i;
    u16 moves[4];
    u8 IVs[6];
    u8 iv_val;
    u16 species     = sDebugMonData->mon_speciesId;
    u8 level        = sDebugMonData->mon_level;
    u8 isShiny      = sDebugMonData->isShiny; //Shiny: no 0, yes 1
    u8 nature       = sDebugMonData->mon_natureId;
    u8 abilityNum   = sDebugMonData->mon_abilityNum;
    moves[0]        = sDebugMonData->mon_move_0;
    moves[1]        = sDebugMonData->mon_move_1;
    moves[2]        = sDebugMonData->mon_move_2;
    moves[3]        = sDebugMonData->mon_move_3;
    IVs[0]          = sDebugMonData->mon_iv_hp;
    IVs[1]          = sDebugMonData->mon_iv_atk;
    IVs[2]          = sDebugMonData->mon_iv_def;
    IVs[3]          = sDebugMonData->mon_iv_speed;
    IVs[4]          = sDebugMonData->mon_iv_satk;
    IVs[5]          = sDebugMonData->mon_iv_sdef;


    //Nature
    if (nature == NUM_NATURES || nature == 0xFF)
        nature = Random() % NUM_NATURES;

    //Shinyness
    if (isShiny == 1)
    {
        u32 personality;
        u32 otid = gSaveBlock2Ptr->playerTrainerId[0]
            | (gSaveBlock2Ptr->playerTrainerId[1] << 8)
            | (gSaveBlock2Ptr->playerTrainerId[2] << 16)
            | (gSaveBlock2Ptr->playerTrainerId[3] << 24);

        do
        {
            personality = Random32();
            personality = ((((Random() % 8) ^ (HIHALF(otid) ^ LOHALF(otid))) ^ LOHALF(personality)) << 16) | LOHALF(personality);
        } while (nature != GetNatureFromPersonality(personality));

        CreateMon(&mon, species, level, 32, 1, personality, OT_ID_PRESET, otid, TRUE);
    }
    else
        CreateMonWithNature(&mon, species, level, 32, nature, TRUE);

    //EVs/IVs
    for (i = 0; i < NUM_STATS; i++)
    {
        // ev
        // if (evs[i] != 0xFF && evTotal < 510)
        // {
        //     // only up to 510 evs
        //     if ((evTotal + evs[i]) > 510)
        //         evs[i] = (510 - evTotal);

        //     evTotal += evs[i];
        //     SetMonData(&mon, MON_DATA_HP_EV + i, &evs[i]);
        // }

        // iv
        iv_val = IVs[i];
        if (iv_val != 32 && iv_val != 0xFF)
            SetMonData(&mon, MON_DATA_HP_IV + i, &iv_val);
    }
    CalculateMonStats(&mon);

    //Moves
    for (i = 0; i < MAX_MON_MOVES; i++)
    {
        if (moves[i] == 0 || moves[i] == 0xFF || moves[i] > MOVES_COUNT)
            continue;

        SetMonMoveSlot(&mon, moves[i], i);
    }

    //Ability
    if (abilityNum == 0xFF || GetAbilityBySpecies(species, abilityNum) == 0)
    {
        do {
            abilityNum = Random() % 3;  // includes hidden abilities
        } while (GetAbilityBySpecies(species, abilityNum) == 0);
    }

    SetMonData(&mon, MON_DATA_ABILITY_NUM, &abilityNum);

    //ball
    // if (ball <= POKEBALL_COUNT)
    //     SetMonData(&mon, MON_DATA_POKEBALL, &ball);

    //item
    // heldItem[0] = item;
    // heldItem[1] = item >> 8;
    // SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem);

    // give player the mon
    //sentToPc = GiveMonToPlayer(&mon);
    SetMonData(&mon, MON_DATA_OT_NAME, gSaveBlock2Ptr->playerName);
    SetMonData(&mon, MON_DATA_OT_GENDER, &gSaveBlock2Ptr->playerGender);
    for (i = 0; i < PARTY_SIZE; i++)
    {
        if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
            break;
    }

    if (i >= PARTY_SIZE)
        sentToPc = SendMonToPC(&mon);
    else
    {
        sentToPc = MON_GIVEN_TO_PARTY;
        CopyMon(&gPlayerParty[i], &mon, sizeof(mon));
        gPlayerPartyCount = i + 1;
    }

    //Pokedex entry
    nationalDexNum = SpeciesToNationalPokedexNum(species);
    switch(sentToPc)
    {
    case MON_GIVEN_TO_PARTY:
    case MON_GIVEN_TO_PC:
        GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
        GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT);
        break;
    case MON_CANT_GIVE:
        break;
    }

    Free(sDebugMonData); //Frees EWRAM of MonData Struct
    DebugAction_DestroyExtraWindow(taskId); //return sentToPc;
}

static void DebugAction_Give_MaxMoney(u8 taskId)
{
    AddMoney(&gSaveBlock1Ptr->money, 999999);
    PlaySE(SE_SHOP);
}

static void DebugAction_Give_MaxCoins(u8 taskId)
{
    SetCoins(9999);
    PlaySE(SE_SHOP);
}
static void DebugAction_Give_FillPCBoxes(u8 taskId)
{
    int boxId, boxPosition;
    u32 personality;
    struct BoxPokemon boxMon;

    personality = Random32();

    CreateBoxMon(&boxMon,
                 SPECIES_MAGIKARP,
                 100,
                 32,
                 personality,
                 0,
                 OT_ID_PLAYER_ID,
                 0,
                 TRUE);

    for (boxId = 0; boxId < TOTAL_BOXES_COUNT; boxId++)
    {
        for (boxPosition = 0; boxPosition < IN_BOX_COUNT; boxPosition++)
        {
            if (!GetBoxMonData(&gPokemonStoragePtr->boxes[boxId][boxPosition], MON_DATA_SANITY_HAS_SPECIES))
            {
                gPokemonStoragePtr->boxes[boxId][boxPosition] = boxMon;
            }
        }
    }
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}

static void DebugAction_Give_FillPCItemStorage(u8 taskId)
{
    u16 itemId;
    u8 usedSlots;

    for (itemId = 1; itemId < ITEMS_COUNT; itemId++)
    {
        usedSlots = CountUsedPCItemSlots();
        if (!CheckPCHasItem(itemId, 1))
            AddPCItem(itemId, 1);
        if (usedSlots == PC_ITEMS_COUNT)
            break;
    }
    Debug_DestroyMenu(taskId, TRUE);
    EnableBothScriptContexts();
}

 static void DebugAction_Give_FillItemsPocket(u8 taskId)
 {
     u16 itemId;

     for (itemId = 1; itemId < ITEMS_COUNT; itemId++)
     {
         u8 pocket = ItemId_GetPocket(itemId);
         if (pocket != POCKET_ITEMS && pocket != POCKET_MEGA_STONE
            && pocket != POCKET_Z_CRYSTAL && pocket != POCKET_LEGENDARY)
             continue;
         AddBagItem(itemId, 1);
     }
//     Debug_DestroyMenu(taskId, FALSE);
//     Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
 }

 static void DebugAction_Give_FillPokeBallsPocket(u8 taskId)
 {
     u16 itemId;

     for (itemId = 1; itemId < ITEMS_COUNT; itemId++)
     {
         if (ItemId_GetPocket(itemId) != POCKET_POKE_BALLS)
             continue;
         AddBagItem(itemId, 1);
     }
//     Debug_DestroyMenu(taskId, FALSE);
//     Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
 }

 static void DebugAction_Give_FillBerriesPocket(u8 taskId)
 {
     u16 itemId;

     for (itemId = 1; itemId < ITEMS_COUNT; itemId++)
     {
         if (ItemId_GetPocket(itemId) != POCKET_BERRIES)
             continue;
         AddBagItem(itemId, 1);
     }
//     Debug_DestroyMenu(taskId, FALSE);
//     Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
 }

 static void DebugAction_Give_FillKeyItemsPocket(u8 taskId)
 {
     u16 itemId;

     for (itemId = 1; itemId < ITEMS_COUNT; itemId++)
     {
         if (ItemId_GetPocket(itemId) != POCKET_KEY_ITEMS)
             continue;
         AddBagItem(itemId, 1);
     }
//     Debug_DestroyMenu(taskId, FALSE);
//     Debug_ShowMenu(DebugTask_HandleMenuInput_Give, sDebugMenu_ListTemplate_Give);
 }

static void Debug_GivePlayerLegendaryMon(void)
{
    static const u16 zacianMoves[] =   {MOVE_IRON_HEAD, MOVE_SACRED_SWORD, MOVE_PLAY_ROUGH, MOVE_SWORDS_DANCE};
    static const u16 groudonMoves[] =  {MOVE_PRECIPICE_BLADES, MOVE_HEAT_CRASH, MOVE_STONE_EDGE, MOVE_SWORDS_DANCE};
    static const u16 kyogreMoves[] =   {MOVE_ORIGIN_PULSE, MOVE_ICE_BEAM, MOVE_THUNDER, MOVE_CALM_MIND};
    static const u16 rayquazaMoves[] = {MOVE_DRAGON_ASCENT, MOVE_V_CREATE, MOVE_EARTHQUAKE, MOVE_EXTREME_SPEED};

    register u16 i, j;
    register u32 PID;

    FlagSet(FLAG_SYS_POKEMON_GET);
    i = (u16)GetPlayerIDAsU32() ^ (u16)(GetPlayerIDAsU32() >> 16);

    //苍响
    do
        j = Random();
    while(NATURE_JOLLY != ((PID = ((i ^ j) << 16) | j) % NUM_NATURES));
    CreateMon(&gEnemyParty[0], SPECIES_ZACIAN, 100, 31, 1, PID, 0, 0, 1);
    SetMonData2(&gEnemyParty[0], MON_DATA_HELD_ITEM, ITEM_RUSTED_SWORD);
    SetMonData2(&gEnemyParty[0], MON_DATA_PP_BONUSES, 0xFF);
    for (j = 0; j < MAX_MON_MOVES; j++)
        SetMonData2(&gEnemyParty[0], MON_DATA_MOVE1 + j, zacianMoves[j]);
    SetMonData2(&gEnemyParty[0], MON_DATA_ATK_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_SPEED_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_HP_EV, 4);
    SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, gText_NameDebugger);
    CalculateMonStats(&gEnemyParty[0]);
    GiveMonToPlayer(&gEnemyParty[0]);

    //固拉多
    do
        j = Random();
    while(NATURE_JOLLY != ((PID = ((i ^ j) << 16) | j) % NUM_NATURES));
    CreateMon(&gEnemyParty[0], SPECIES_GROUDON, 100, 31, 1, PID, 0, 0, 1);
    SetMonData2(&gEnemyParty[0], MON_DATA_HELD_ITEM, ITEM_RED_ORB);
    SetMonData2(&gEnemyParty[0], MON_DATA_PP_BONUSES, 0xFF);
    for (j = 0; j < MAX_MON_MOVES; j++)
        SetMonData2(&gEnemyParty[0], MON_DATA_MOVE1 + j, groudonMoves[j]);
    SetMonData2(&gEnemyParty[0], MON_DATA_ATK_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_SPEED_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_HP_EV, 4);
    SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, gText_NameDebugger);
    CalculateMonStats(&gEnemyParty[0]);
    GiveMonToPlayer(&gEnemyParty[0]);

    //盖欧卡
    do
        j = Random();
    while(NATURE_TIMID != ((PID = ((i ^ j) << 16) | j) % NUM_NATURES));
    CreateMon(&gEnemyParty[0], SPECIES_KYOGRE, 100, 31, 1, PID, 0, 0, 1);
    SetMonData2(&gEnemyParty[0], MON_DATA_HELD_ITEM, ITEM_BLUE_ORB);
    SetMonData2(&gEnemyParty[0], MON_DATA_PP_BONUSES, 0xFF);
    for (j = 0; j < MAX_MON_MOVES; j++)
        SetMonData2(&gEnemyParty[0], MON_DATA_MOVE1 + j, kyogreMoves[j]);
    SetMonData2(&gEnemyParty[0], MON_DATA_SPATK_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_SPEED_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_HP_EV, 4);
    SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, gText_NameDebugger);
    CalculateMonStats(&gEnemyParty[0]);
    GiveMonToPlayer(&gEnemyParty[0]);

    //烈空座
    do
        j = Random();
    while(NATURE_JOLLY != ((PID = ((i ^ j) << 16) | j) % NUM_NATURES));
    CreateMon(&gEnemyParty[0], SPECIES_RAYQUAZA, 100, 31, 1, PID, 0, 0, 1);
    SetMonData2(&gEnemyParty[0], MON_DATA_HELD_ITEM, ITEM_CHOICE_BAND);
    SetMonData2(&gEnemyParty[0], MON_DATA_PP_BONUSES, 0xFF);
    for (j = 0; j < MAX_MON_MOVES; j++)
        SetMonData2(&gEnemyParty[0], MON_DATA_MOVE1 + j, rayquazaMoves[j]);
    SetMonData2(&gEnemyParty[0], MON_DATA_ATK_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_SPEED_EV, 252);
    SetMonData2(&gEnemyParty[0], MON_DATA_HP_EV, 4);
    SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, gText_NameDebugger);
    CalculateMonStats(&gEnemyParty[0]);
    GiveMonToPlayer(&gEnemyParty[0]);

    HealPlayerParty();
}

static void DebugAction_Give_CHEAT(u8 taskId)
{
    u16 i;

    Debug_GivePlayerLegendaryMon();
    SetMoney(&gSaveBlock1Ptr->money, 99999999);
    SetCoins(9999);

    FlagSet(FLAG_SYS_POKEMON_GET);
    FlagSet(FLAG_SYS_POKEDEX_GET);
    FlagSet(FLAG_SYS_B_DASH);
    EnableNationalPokedex();

    AddBagItem(ITEM_MASTER_BALL, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_BOTTLE_CAP, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_GOLD_BOTTLE_CAP, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_ABILITY_PATCH, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_ABILITY_CAPSULE, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_RARE_CANDY, MAX_BUY_ITEM_CAPACITY);
    AddBagItem(ITEM_MEGA_BRACELET, 1); //提前给手镯
    AddBagItem(ITEM_MEGA_BRACELET, 1); //提前给手镯
    AddBagItem(ITEM_Z_RING, 1);
    AddBagItem(ITEM_MEGA_BOX, 1);
    AddBagItem(ITEM_Z_BOX, 1);
    AddBagItem(ITEM_DYNAMAX_BAND, 1);
    AddBagItem(ITEM_LEGENDARY_VOUCHER, 1);
    AddBagItem(ITEM_GOOD_ROD, 1);
    AddBagItem(ITEM_MACH_BIKE, 1);
    AddBagItem(ITEM_ACRO_BIKE, 1);
    for (i = ITEM_LONELY_MINT; i <= ITEM_SERIOUS_MINT; i++)
        AddBagItem(i, MAX_BUY_ITEM_CAPACITY);
    gTasks[taskId].func = DebugAction_Give_AllTMs; // GIve TM HM and exit
//    ScriptContext1_SetupScript(EventScript_DebugPack);
}

// *******************************
// Sound Scripts
static const u8 *const gBGMNames[];
static const u8 *const gSENames[];
static void DebugAction_Sound_SE(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, 1, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
    StringCopyPadded(gStringVar1, gSENames[0], CHAR_SPACE, 35);
    StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SE_ID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    StopMapMusic(); //Stop map music to better hear sounds

    gTasks[taskId].func = DebugAction_Sound_SE_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = 1;            //Current ID
    gTasks[taskId].data[4] = 0;                    //Digit Selected
}

static void DebugAction_Sound_SE_SelectId(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > END_SE)
                gTasks[taskId].data[3] = END_SE;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < 1)
                gTasks[taskId].data[3] = 1;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringCopyPadded(gStringVar1, gSENames[gTasks[taskId].data[3]-1], CHAR_SPACE, 35);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
        StringExpandPlaceholders(gStringVar4, sDebugText_Sound_SE_ID);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        m4aSongNumStop(gTasks[taskId].data[5]);
        gTasks[taskId].data[5] = gTasks[taskId].data[3];
        m4aSongNumStart(gTasks[taskId].data[3]);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        m4aSongNumStop(gTasks[taskId].data[5]);
        Debug_DestroyMenu(taskId, TRUE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound);
    }
}

static void DebugAction_Sound_MUS(u8 taskId)
{
    u8 windowId;

    ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE);
    RemoveWindow(gTasks[taskId].data[1]);

    HideMapNamePopUpWindow();
    LoadMessageBoxAndBorderGfx();
    windowId = AddWindow(&sDebugNumberDisplayLargeWindowTemplate);
    DrawStdWindowFrame(windowId, FALSE);

    CopyWindowToVram(windowId, 3);

    //Display initial ID
    StringCopy(gStringVar2, gText_DigitIndicator[0]);
    ConvertIntToDecimalStringN(gStringVar3, START_MUS, STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
    StringCopyPadded(gStringVar1, gBGMNames[0], CHAR_SPACE, 35);
    StringExpandPlaceholders(gStringVar4, sDebugText_Sound_MUS_ID);
    _AddTextPrinterParameterized(windowId, 1, gStringVar4, 1, 1, 0, NULL);

    StopMapMusic(); //Stop map music to better hear new music

    gTasks[taskId].func = DebugAction_Sound_MUS_SelectId;
    gTasks[taskId].data[2] = windowId;
    gTasks[taskId].data[3] = START_MUS;                 //Current ID
    gTasks[taskId].data[4] = 0;                         //Digit Selected
    gTasks[taskId].data[5] = gTasks[taskId].data[3];    //Last song played (for stopping)
}
static void DebugAction_Sound_MUS_SelectId(u8 taskId)
{
    if (gMain.newKeys & DPAD_ANY)
    {
        if (gMain.newKeys & DPAD_UP)
        {
            gTasks[taskId].data[3] += sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] > END_MUS)
                gTasks[taskId].data[3] = END_MUS;
        }
        if (gMain.newKeys & DPAD_DOWN)
        {
            gTasks[taskId].data[3] -= sPowersOfTen[gTasks[taskId].data[4]];
            if (gTasks[taskId].data[3] < START_MUS)
                gTasks[taskId].data[3] = START_MUS;
        }
        if (gMain.newKeys & DPAD_LEFT)
        {
            if (gTasks[taskId].data[4] > 0)
                gTasks[taskId].data[4] -= 1;
        }
        if (gMain.newKeys & DPAD_RIGHT)
        {
            if (gTasks[taskId].data[4] < DEBUG_NUMBER_DIGITS_ITEMS-1)
                gTasks[taskId].data[4] += 1;
        }

        StringCopy(gStringVar2, gText_DigitIndicator[gTasks[taskId].data[4]]);
        StringCopyPadded(gStringVar1, gBGMNames[gTasks[taskId].data[3]-START_MUS], CHAR_SPACE, 35);
        ConvertIntToDecimalStringN(gStringVar3, gTasks[taskId].data[3], STR_CONV_MODE_LEADING_ZEROS, DEBUG_NUMBER_DIGITS_ITEMS);
        StringExpandPlaceholders(gStringVar4, sDebugText_Sound_MUS_ID);
        _AddTextPrinterParameterized(gTasks[taskId].data[2], 1, gStringVar4, 1, 1, 0, NULL);
    }

    if (gMain.newKeys & A_BUTTON)
    {
        m4aSongNumStop(gTasks[taskId].data[5]);
        gTasks[taskId].data[5] = gTasks[taskId].data[3];
        m4aSongNumStart(gTasks[taskId].data[3]);
    }
    else if (gMain.newKeys & B_BUTTON)
    {
        PlaySE(SE_SELECT);
        // m4aSongNumStop(gTasks[taskId].data[5]);   //Uncomment if music should stop after leaving menu
        Debug_DestroyMenu(taskId, TRUE);
        Debug_ShowMenu(DebugTask_HandleMenuInput_Sound, sDebugMenu_ListTemplate_Sound);
    }
}

#define SOUND_LIST_BGM \
    X(MUS_LITTLEROOT_TEST, "MUS-LITTLEROOT-TEST") \
    X(MUS_GSC_ROUTE38, "MUS-GSC-ROUTE38") \
    X(MUS_CAUGHT, "MUS-CAUGHT") \
    X(MUS_VICTORY_WILD, "MUS-VICTORY-WILD") \
    X(MUS_VICTORY_GYM_LEADER, "MUS-VICTORY-GYM-LEADER") \
    X(MUS_VICTORY_LEAGUE, "MUS-VICTORY-LEAGUE") \
    X(MUS_C_COMM_CENTER, "MUS-C-COMM-CENTER") \
    X(MUS_GSC_PEWTER, "MUS-GSC-PEWTER") \
    X(MUS_C_VS_LEGEND_BEAST, "MUS-C-VS-LEGEND-BEAST") \
    X(MUS_ROUTE101, "MUS-ROUTE101") \
    X(MUS_ROUTE110, "MUS-ROUTE110") \
    X(MUS_ROUTE120, "MUS-ROUTE120") \
    X(MUS_PETALBURG, "MUS-PETALBURG") \
    X(MUS_OLDALE, "MUS-OLDALE") \
    X(MUS_GYM, "MUS-GYM") \
    X(MUS_SURF, "MUS-SURF") \
    X(MUS_PETALBURG_WOODS, "MUS-PETALBURG-WOODS") \
    X(MUS_LEVEL_UP, "MUS-LEVEL-UP") \
    X(MUS_HEAL, "MUS-HEAL") \
    X(MUS_OBTAIN_BADGE, "MUS-OBTAIN-BADGE") \
    X(MUS_OBTAIN_ITEM, "MUS-OBTAIN-ITEM") \
    X(MUS_EVOLVED, "MUS-EVOLVED") \
    X(MUS_OBTAIN_TMHM, "MUS-OBTAIN-TMHM") \
    X(MUS_LILYCOVE_MUSEUM, "MUS-LILYCOVE-MUSEUM") \
    X(MUS_ROUTE122, "MUS-ROUTE122") \
    X(MUS_OCEANIC_MUSEUM, "MUS-OCEANIC-MUSEUM") \
    X(MUS_EVOLUTION_INTRO, "MUS-EVOLUTION-INTRO") \
    X(MUS_EVOLUTION, "MUS-EVOLUTION") \
    X(MUS_MOVE_DELETED, "MUS-MOVE-DELETED") \
    X(MUS_ENCOUNTER_GIRL, "MUS-ENCOUNTER-GIRL") \
    X(MUS_ENCOUNTER_MALE, "MUS-ENCOUNTER-MALE") \
    X(MUS_ABANDONED_SHIP, "MUS-ABANDONED-SHIP") \
    X(MUS_FORTREE, "MUS-FORTREE") \
    X(MUS_BIRCH_LAB, "MUS-BIRCH-LAB") \
    X(MUS_B_TOWER_RS, "MUS-B-TOWER-RS") \
    X(MUS_ENCOUNTER_SWIMMER, "MUS-ENCOUNTER-SWIMMER") \
    X(MUS_CAVE_OF_ORIGIN, "MUS-CAVE-OF-ORIGIN") \
    X(MUS_OBTAIN_BERRY, "MUS-OBTAIN-BERRY") \
    X(MUS_AWAKEN_LEGEND, "MUS-AWAKEN-LEGEND") \
    X(MUS_SLOTS_JACKPOT, "MUS-SLOTS-JACKPOT") \
    X(MUS_SLOTS_WIN, "MUS-SLOTS-WIN") \
    X(MUS_TOO_BAD, "MUS-TOO-BAD") \
    X(MUS_ROULETTE, "MUS-ROULETTE") \
    X(MUS_LINK_CONTEST_P1, "MUS-LINK-CONTEST-P1") \
    X(MUS_LINK_CONTEST_P2, "MUS-LINK-CONTEST-P2") \
    X(MUS_LINK_CONTEST_P3, "MUS-LINK-CONTEST-P3") \
    X(MUS_LINK_CONTEST_P4, "MUS-LINK-CONTEST-P4") \
    X(MUS_ENCOUNTER_RICH, "MUS-ENCOUNTER-RICH") \
    X(MUS_VERDANTURF, "MUS-VERDANTURF") \
    X(MUS_RUSTBORO, "MUS-RUSTBORO") \
    X(MUS_POKE_CENTER, "MUS-POKE-CENTER") \
    X(MUS_ROUTE104, "MUS-ROUTE104") \
    X(MUS_ROUTE119, "MUS-ROUTE119") \
    X(MUS_CYCLING, "MUS-CYCLING") \
    X(MUS_POKE_MART, "MUS-POKE-MART") \
    X(MUS_LITTLEROOT, "MUS-LITTLEROOT") \
    X(MUS_MT_CHIMNEY, "MUS-MT-CHIMNEY") \
    X(MUS_ENCOUNTER_FEMALE, "MUS-ENCOUNTER-FEMALE") \
    X(MUS_LILYCOVE, "MUS-LILYCOVE") \
    X(MUS_ROUTE111, "MUS-ROUTE111") \
    X(MUS_HELP, "MUS-HELP") \
    X(MUS_UNDERWATER, "MUS-UNDERWATER") \
    X(MUS_VICTORY_TRAINER, "MUS-VICTORY-TRAINER") \
    X(MUS_TITLE, "MUS-TITLE") \
    X(MUS_INTRO, "MUS-INTRO") \
    X(MUS_ENCOUNTER_MAY, "MUS-ENCOUNTER-MAY") \
    X(MUS_ENCOUNTER_INTENSE, "MUS-ENCOUNTER-INTENSE") \
    X(MUS_ENCOUNTER_COOL, "MUS-ENCOUNTER-COOL") \
    X(MUS_ROUTE113, "MUS-ROUTE113") \
    X(MUS_ENCOUNTER_AQUA, "MUS-ENCOUNTER-AQUA") \
    X(MUS_FOLLOW_ME, "MUS-FOLLOW-ME") \
    X(MUS_ENCOUNTER_BRENDAN, "MUS-ENCOUNTER-BRENDAN") \
    X(MUS_EVER_GRANDE, "MUS-EVER-GRANDE") \
    X(MUS_ENCOUNTER_SUSPICIOUS, "MUS-ENCOUNTER-SUSPICIOUS") \
    X(MUS_VICTORY_AQUA_MAGMA, "MUS-VICTORY-AQUA-MAGMA") \
    X(MUS_CABLE_CAR, "MUS-CABLE-CAR") \
    X(MUS_GAME_CORNER, "MUS-GAME-CORNER") \
    X(MUS_DEWFORD, "MUS-DEWFORD") \
    X(MUS_SAFARI_ZONE, "MUS-SAFARI-ZONE") \
    X(MUS_VICTORY_ROAD, "MUS-VICTORY-ROAD") \
    X(MUS_AQUA_MAGMA_HIDEOUT, "MUS-AQUA-MAGMA-HIDEOUT") \
    X(MUS_SAILING, "MUS-SAILING") \
    X(MUS_MT_PYRE, "MUS-MT-PYRE") \
    X(MUS_SLATEPORT, "MUS-SLATEPORT") \
    X(MUS_MT_PYRE_EXTERIOR, "MUS-MT-PYRE-EXTERIOR") \
    X(MUS_SCHOOL, "MUS-SCHOOL") \
    X(MUS_HALL_OF_FAME, "MUS-HALL-OF-FAME") \
    X(MUS_FALLARBOR, "MUS-FALLARBOR") \
    X(MUS_SEALED_CHAMBER, "MUS-SEALED-CHAMBER") \
    X(MUS_CONTEST_WINNER, "MUS-CONTEST-WINNER") \
    X(MUS_CONTEST, "MUS-CONTEST") \
    X(MUS_ENCOUNTER_MAGMA, "MUS-ENCOUNTER-MAGMA") \
    X(MUS_INTRO_BATTLE, "MUS-INTRO-BATTLE") \
    X(MUS_WEATHER_KYOGRE, "MUS-WEATHER-KYOGRE") \
    X(MUS_WEATHER_GROUDON, "MUS-WEATHER-GROUDON") \
    X(MUS_SOOTOPOLIS, "MUS-SOOTOPOLIS") \
    X(MUS_CONTEST_RESULTS, "MUS-CONTEST-RESULTS") \
    X(MUS_HALL_OF_FAME_ROOM, "MUS-HALL-OF-FAME-ROOM") \
    X(MUS_TRICK_HOUSE, "MUS-TRICK-HOUSE") \
    X(MUS_ENCOUNTER_TWINS, "MUS-ENCOUNTER-TWINS") \
    X(MUS_ENCOUNTER_ELITE_FOUR, "MUS-ENCOUNTER-ELITE-FOUR") \
    X(MUS_ENCOUNTER_HIKER, "MUS-ENCOUNTER-HIKER") \
    X(MUS_CONTEST_LOBBY, "MUS-CONTEST-LOBBY") \
    X(MUS_ENCOUNTER_INTERVIEWER, "MUS-ENCOUNTER-INTERVIEWER") \
    X(MUS_ENCOUNTER_CHAMPION, "MUS-ENCOUNTER-CHAMPION") \
    X(MUS_CREDITS, "MUS-CREDITS") \
    X(MUS_END, "MUS-END") \
    X(MUS_VS_WILD, "MUS-VS-WILD") \
    X(MUS_VS_AQUA_MAGMA, "MUS-VS-AQUA-MAGMA") \
    X(MUS_VS_TRAINER, "MUS-VS-TRAINER") \
    X(MUS_VS_GYM_LEADER, "MUS-VS-GYM-LEADER") \
    X(MUS_VS_CHAMPION, "MUS-VS-CHAMPION") \
    X(MUS_VS_REGI, "MUS-VS-REGI") \
    X(MUS_VS_KYOGRE_GROUDON, "MUS-VS-KYOGRE-GROUDON") \
    X(MUS_VS_RIVAL, "MUS-VS-RIVAL") \
    X(MUS_VS_ELITE_FOUR, "MUS-VS-ELITE-FOUR") \
    X(MUS_VS_AQUA_MAGMA_LEADER, "MUS-VS-AQUA-MAGMA-LEADER") \
    X(MUS_RG_FOLLOW_ME, "MUS-RG-FOLLOW-ME") \
    X(MUS_RG_GAME_CORNER, "MUS-RG-GAME-CORNER") \
    X(MUS_RG_ROCKET_HIDEOUT, "MUS-RG-ROCKET-HIDEOUT") \
    X(MUS_RG_GYM, "MUS-RG-GYM") \
    X(MUS_RG_JIGGLYPUFF, "MUS-RG-JIGGLYPUFF") \
    X(MUS_RG_INTRO_FIGHT, "MUS-RG-INTRO-FIGHT") \
    X(MUS_RG_TITLE, "MUS-RG-TITLE") \
    X(MUS_RG_CINNABAR, "MUS-RG-CINNABAR") \
    X(MUS_RG_LAVENDER, "MUS-RG-LAVENDER") \
    X(MUS_RG_HEAL, "MUS-RG-HEAL") \
    X(MUS_RG_CYCLING, "MUS-RG-CYCLING") \
    X(MUS_RG_ENCOUNTER_ROCKET, "MUS-RG-ENCOUNTER-ROCKET") \
    X(MUS_RG_ENCOUNTER_GIRL, "MUS-RG-ENCOUNTER-GIRL") \
    X(MUS_RG_ENCOUNTER_BOY, "MUS-RG-ENCOUNTER-BOY") \
    X(MUS_RG_HALL_OF_FAME, "MUS-RG-HALL-OF-FAME") \
    X(MUS_RG_VIRIDIAN_FOREST, "MUS-RG-VIRIDIAN-FOREST") \
    X(MUS_RG_MT_MOON, "MUS-RG-MT-MOON") \
    X(MUS_RG_POKE_MANSION, "MUS-RG-POKE-MANSION") \
    X(MUS_RG_CREDITS, "MUS-RG-CREDITS") \
    X(MUS_RG_ROUTE1, "MUS-RG-ROUTE1") \
    X(MUS_RG_ROUTE24, "MUS-RG-ROUTE24") \
    X(MUS_RG_ROUTE3, "MUS-RG-ROUTE3") \
    X(MUS_RG_ROUTE11, "MUS-RG-ROUTE11") \
    X(MUS_RG_VICTORY_ROAD, "MUS-RG-VICTORY-ROAD") \
    X(MUS_RG_VS_GYM_LEADER, "MUS-RG-VS-GYM-LEADER") \
    X(MUS_RG_VS_TRAINER, "MUS-RG-VS-TRAINER") \
    X(MUS_RG_VS_WILD, "MUS-RG-VS-WILD") \
    X(MUS_RG_VS_CHAMPION, "MUS-RG-VS-CHAMPION") \
    X(MUS_RG_PALLET, "MUS-RG-PALLET") \
    X(MUS_RG_OAK_LAB, "MUS-RG-OAK-LAB") \
    X(MUS_RG_OAK, "MUS-RG-OAK") \
    X(MUS_RG_POKE_CENTER, "MUS-RG-POKE-CENTER") \
    X(MUS_RG_SS_ANNE, "MUS-RG-SS-ANNE") \
    X(MUS_RG_SURF, "MUS-RG-SURF") \
    X(MUS_RG_POKE_TOWER, "MUS-RG-POKE-TOWER") \
    X(MUS_RG_SILPH, "MUS-RG-SILPH") \
    X(MUS_RG_FUCHSIA, "MUS-RG-FUCHSIA") \
    X(MUS_RG_CELADON, "MUS-RG-CELADON") \
    X(MUS_RG_VERMILLION, "MUS-RG-VERMILLION") \
    X(MUS_RG_PEWTER, "MUS-RG-PEWTER") \
    X(MUS_RG_ENCOUNTER_RIVAL, "MUS-RG-ENCOUNTER-RIVAL") \
    X(MUS_RG_RIVAL_EXIT, "MUS-RG-RIVAL-EXIT") \
    X(MUS_RG_DEX_RATING, "MUS-RG-DEX-RATING") \
    X(MUS_RG_OBTAIN_KEY_ITEM, "MUS-RG-OBTAIN-KEY-ITEM") \
    X(MUS_RG_CAUGHT_INTRO, "MUS-RG-CAUGHT-INTRO") \
    X(MUS_RG_PHOTO, "MUS-RG-PHOTO") \
    X(MUS_RG_GAME_FREAK, "MUS-RG-GAME-FREAK") \
    X(MUS_RG_CAUGHT, "MUS-RG-CAUGHT") \
    X(MUS_RG_NEW_GAME_INSTRUCT, "MUS-RG-NEW-GAME-INSTRUCT") \
    X(MUS_RG_NEW_GAME_INTRO, "MUS-RG-NEW-GAME-INTRO") \
    X(MUS_RG_NEW_GAME_EXIT, "MUS-RG-NEW-GAME-EXIT") \
    X(MUS_RG_POKE_JUMP, "MUS-RG-POKE-JUMP") \
    X(MUS_RG_UNION_ROOM, "MUS-RG-UNION-ROOM") \
    X(MUS_RG_NET_CENTER, "MUS-RG-NET-CENTER") \
    X(MUS_RG_MYSTERY_GIFT, "MUS-RG-MYSTERY-GIFT") \
    X(MUS_RG_BERRY_PICK, "MUS-RG-BERRY-PICK") \
    X(MUS_RG_SEVII_ROUTE, "MUS-RG-SEVII-ROUTE") \
    X(MUS_RG_SEVII_45, "MUS-RG-SEVII-45") \
    X(MUS_RG_SEVII_67, "MUS-RG-SEVII-67") \
    X(MUS_RG_POKE_FLUTE, "MUS-RG-POKE-FLUTE") \
    X(MUS_RG_VS_DEOXYS, "MUS-RG-VS-DEOXYS") \
    X(MUS_RG_VS_MEWTWO, "MUS-RG-VS-MEWTWO") \
    X(MUS_RG_VS_LEGEND, "MUS-RG-VS-LEGEND") \
    X(MUS_RG_ENCOUNTER_GYM_LEADER, "MUS-RG-ENCOUNTER-GYM-LEADER") \
    X(MUS_RG_ENCOUNTER_DEOXYS, "MUS-RG-ENCOUNTER-DEOXYS") \
    X(MUS_RG_TRAINER_TOWER, "MUS-RG-TRAINER-TOWER") \
    X(MUS_RG_SLOW_PALLET, "MUS-RG-SLOW-PALLET") \
    X(MUS_RG_TEACHY_TV_MENU, "MUS-RG-TEACHY-TV-MENU") \
    X(MUS_ABNORMAL_WEATHER, "MUS-ABNORMAL-WEATHER") \
    X(MUS_B_FRONTIER, "MUS-B-FRONTIER") \
    X(MUS_B_ARENA, "MUS-B-ARENA") \
    X(MUS_OBTAIN_B_POINTS, "MUS-OBTAIN-B-POINTS") \
    X(MUS_REGISTER_MATCH_CALL, "MUS-REGISTER-MATCH-CALL") \
    X(MUS_B_PYRAMID, "MUS-B-PYRAMID") \
    X(MUS_B_PYRAMID_TOP, "MUS-B-PYRAMID-TOP") \
    X(MUS_B_PALACE, "MUS-B-PALACE") \
    X(MUS_RAYQUAZA_APPEARS, "MUS-RAYQUAZA-APPEARS") \
    X(MUS_B_TOWER, "MUS-B-TOWER") \
    X(MUS_OBTAIN_SYMBOL, "MUS-OBTAIN-SYMBOL") \
    X(MUS_B_DOME, "MUS-B-DOME") \
    X(MUS_B_PIKE, "MUS-B-PIKE") \
    X(MUS_B_FACTORY, "MUS-B-FACTORY") \
    X(MUS_VS_FRONTIER_BRAIN, "MUS-VS-FRONTIER-BRAIN") \
    X(MUS_VS_MEW, "MUS-VS-MEW") \
    X(MUS_B_DOME_LOBBY, "MUS-B-DOME-LOBBY") \
    X(DP_SEQ_TITLE00    , "DP-SEQ-TITLE00") \
    X(DP_SEQ_TITLE01    , "DP-SEQ-TITLE01") \
    X(DP_SEQ_OPENING    , "DP-SEQ-OPENING") \
    X(DP_SEQ_TV_HOUSOU  , "DP-SEQ-TV-HOUSOU") \
    X(DP_SEQ_TV_END     , "DP-SEQ-TV-END") \
    X(DP_SEQ_TOWN01_D   , "DP-SEQ-TOWN01-D") \
    X(DP_SEQ_TOWN01_N   , "DP-SEQ-TOWN01-N") \
    X(DP_SEQ_THE_RIV    , "DP-SEQ-THE-RIV") \
    X(DP_SEQ_ROAD_A_D   , "DP-SEQ-ROAD-A-D") \
    X(DP_SEQ_ROAD_A_N   , "DP-SEQ-ROAD-A-N") \
    X(DP_SEQ_D_LAKE     , "DP-SEQ-D-LAKE") \
    X(DP_SEQ_THE_EVENT01, "DP-SEQ-THE-EVENT01") \
    X(DP_SEQ_BA_POKE    , "DP-SEQ-BA-POKE") \
    X(DP_SEQ_WINPOKE    , "DP-SEQ-WINPOKE") \
    X(DP_SEQ_THE_GIRL   , "DP-SEQ-THE-GIRL") \
    X(DP_SEQ_THE_BOY    , "DP-SEQ-THE-BOY") \
    X(DP_SEQ_FANFA4     , "DP-SEQ-FANFA4") \
    X(DP_SEQ_TOWN02_D   , "DP-SEQ-TOWN02-D") \
    X(DP_SEQ_TOWN02_N   , "DP-SEQ-TOWN02-N") \
    X(DP_SEQ_KENKYUJO   , "DP-SEQ-KENKYUJO") \
    X(DP_SEQ_TSURETEKE  , "DP-SEQ-TSURETEKE") \
    X(DP_SEQ_PC_01      , "DP-SEQ-PC-01") \
    X(DP_SEQ_PC_02      , "DP-SEQ-PC-02") \
    X(DP_SEQ_ASA        , "DP-SEQ-ASA") \
    X(DP_SEQ_EYE_BOY    , "DP-SEQ-EYE-BOY") \
    X(DP_SEQ_EYE_GIRL   , "DP-SEQ-EYE-GIRL") \
    X(DP_SEQ_BA_TRAIN   , "DP-SEQ-BA-TRAIN") \
    X(DP_SEQ_WINTRAIN   , "DP-SEQ-WINTRAIN") \
    X(DP_SEQ_CITY01_D   , "DP-SEQ-CITY01-D") \
    X(DP_SEQ_CITY01_N   , "DP-SEQ-CITY01-N") \
    X(DP_SEQ_FANFA3     , "DP-SEQ-FANFA3") \
    X(DP_SEQ_FS         , "DP-SEQ-FS") \
    X(DP_SEQ_ROAD_B_D   , "DP-SEQ-ROAD-B-D") \
    X(DP_SEQ_ROAD_B_N   , "DP-SEQ-ROAD-B-N") \
    X(DP_SEQ_BA_RIVAL   , "DP-SEQ-BA-RIVAL") \
    X(DP_SEQ_D_05       , "DP-SEQ-D-05") \
    X(DP_SEQ_WAZA       , "DP-SEQ-WAZA") \
    X(DP_SEQ_CITY03_D   , "DP-SEQ-CITY03-D") \
    X(DP_SEQ_CITY03_N   , "DP-SEQ-CITY03-N") \
    X(DP_SEQ_D_04       , "DP-SEQ-D-04") \
    X(DP_SEQ_GYM        , "DP-SEQ-GYM") \
    X(DP_SEQ_BA_GYM     , "DP-SEQ-BA-GYM") \
    X(DP_SEQ_WINTGYM    , "DP-SEQ-WINTGYM") \
    X(DP_SEQ_BADGE      , "DP-SEQ-BADGE") \
    X(DP_SEQ_EYE_KID    , "DP-SEQ-EYE-KID") \
    X(DP_SEQ_FANFA1     , "DP-SEQ-FANFA1") \
    X(DP_SEQ_TOWN03_D   , "DP-SEQ-TOWN03-D") \
    X(DP_SEQ_TOWN03_N   , "DP-SEQ-TOWN03-N") \
    X(DP_SEQ_KINOMI     , "DP-SEQ-KINOMI") \
    X(DP_SEQ_ROAD_C_D   , "DP-SEQ-ROAD-C-D") \
    X(DP_SEQ_ROAD_C_N   , "DP-SEQ-ROAD-C-N") \
    X(DP_SEQ_EYE_GINGA  , "DP-SEQ-EYE-GINGA") \
    X(DP_SEQ_BA_GINGA   , "DP-SEQ-BA-GINGA") \
    X(DP_SEQ_D_02       , "DP-SEQ-D-02") \
    X(DP_SEQ_GONIN      , "DP-SEQ-GONIN") \
    X(DP_SEQ_CITY04_D   , "DP-SEQ-CITY04-D") \
    X(DP_SEQ_CITY04_N   , "DP-SEQ-CITY04-N") \
    X(DP_SEQ_D_GINLOBBY , "DP-SEQ-D-GINLOBBY") \
    X(DP_SEQ_BA_GINGA3  , "DP-SEQ-BA-GINGA3") \
    X(DP_SEQ_WINGINGA   , "DP-SEQ-WINGINGA") \
    X(DP_SEQ_SHINKA     , "DP-SEQ-SHINKA") \
    X(DP_SEQ_FANFA5     , "DP-SEQ-FANFA5") \
    X(DP_SEQ_BICYCLE    , "DP-SEQ-BICYCLE") \
    X(DP_SEQ_EYE_SPORT  , "DP-SEQ-EYE-SPORT") \
    X(DP_SEQ_ROAD_D_D   , "DP-SEQ-ROAD-D-D") \
    X(DP_SEQ_ROAD_D_N   , "DP-SEQ-ROAD-D-N") \
    X(DP_SEQ_CITY05_D   , "DP-SEQ-CITY05-D") \
    X(DP_SEQ_CITY05_N   , "DP-SEQ-CITY05-N") \
    X(DP_SEQ_ROAD_E_D   , "DP-SEQ-ROAD-E-D") \
    X(DP_SEQ_ROAD_E_N   , "DP-SEQ-ROAD-E-N") \
    X(DP_SEQ_EYE_MOUNT  , "DP-SEQ-EYE-MOUNT") \
    X(DP_SEQ_TOWN04_D   , "DP-SEQ-TOWN04-D") \
    X(DP_SEQ_TOWN04_N   , "DP-SEQ-TOWN04-N") \
    X(DP_SEQ_POCKETCH   , "DP-SEQ-POCKETCH") \
    X(DP_SEQ_ROAD_F_D   , "DP-SEQ-ROAD-F-D") \
    X(DP_SEQ_ROAD_F_N   , "DP-SEQ-ROAD-F-N") \
    X(DP_SEQ_CITY07_D   , "DP-SEQ-CITY07-D") \
    X(DP_SEQ_CITY07_N   , "DP-SEQ-CITY07-N") \
    X(DP_SEQ_TOWN07_D   , "DP-SEQ-TOWN07-D") \
    X(DP_SEQ_TOWN07_N   , "DP-SEQ-TOWN07-N") \
    X(DP_SEQ_CITY02_D             , "DP-SEQ-CITY02-D") \
    X(DP_SEQ_CITY02_N             , "DP-SEQ-CITY02-N") \
    X(DP_SEQ_ROAD_SNOW_D          , "DP-SEQ-ROAD-SNOW-D") \
    X(DP_SEQ_ROAD_SNOW_N          , "DP-SEQ-ROAD-SNOW-N") \
    X(DP_SEQ_CITY09_D             , "DP-SEQ-CITY09-D") \
    X(DP_SEQ_CITY09_N             , "DP-SEQ-CITY09-N") \
    X(DP_SEQ_D_AGITO              , "DP-SEQ-D-AGITO") \
    X(DP_SEQ_BA_AGAKI             , "DP-SEQ-BA-AGAKI") \
    X(DP_SEQ_THE_EVENT04          , "DP-SEQ-THE-EVENT04") \
    X(DP_SEQ_D_MOUNT1             , "DP-SEQ-D-MOUNT1") \
    X(DP_SEQ_D_MOUNT2             , "DP-SEQ-D-MOUNT2") \
    X(DP_SEQ_THE_EVENT02          , "DP-SEQ-THE-EVENT02") \
    X(DP_SEQ_THE_EVENT03          , "DP-SEQ-THE-EVENT03") \
    X(DP_SEQ_BA_DPOKE2            , "DP-SEQ-BA-DPOKE2") \
    X(DP_SEQ_CITY08_D             , "DP-SEQ-CITY08-D") \
    X(DP_SEQ_CITY08_N             , "DP-SEQ-CITY08-N") \
    X(DP_SEQ_D_01                 , "DP-SEQ-D-01") \
    X(DP_SEQ_EYE_ELITE            , "DP-SEQ-EYE-ELITE") \
    X(DP_SEQ_CITY10_D             , "DP-SEQ-CITY10-D") \
    X(DP_SEQ_CITY10_N             , "DP-SEQ-CITY10-N") \
    X(DP_SEQ_CITY11_D             , "DP-SEQ-CITY11-D") \
    X(DP_SEQ_CITY11_N             , "DP-SEQ-CITY11-N") \
    X(DP_SEQ_TOWN06_D             , "DP-SEQ-TOWN06-D") \
    X(DP_SEQ_TOWN06_N             , "DP-SEQ-TOWN06-N") \
    X(DP_SEQ_ROAD_BZA_D           , "DP-SEQ-ROAD-BZA-D") \
    X(DP_SEQ_ROAD_BZA_N           , "DP-SEQ-ROAD-BZA-N") \
    X(DP_SEQ_WIFILOBBY            , "DP-SEQ-WIFILOBBY") \
    X(DP_SEQ_BLD_TV               , "DP-SEQ-BLD-TV") \
    X(DP_SEQ_BLD_BLD_GTC          , "DP-SEQ-BLD-BLD-GTC") \
    X(DP_SEQ_NAMINORI             , "DP-SEQ-NAMINORI") \
    X(DP_SEQ_WASURE               , "DP-SEQ-WASURE") \
    X(DP_SEQ_EYE_FIGHT            , "DP-SEQ-EYE-FIGHT") \
    X(DP_SEQ_EYE_ENKA             , "DP-SEQ-EYE-ENKA") \
    X(DP_SEQ_TANKOU               , "DP-SEQ-TANKOU") \
    X(DP_SEQ_HATANIGE             , "DP-SEQ-HATANIGE") \
    X(DP_SEQ_EYE_LADY             , "DP-SEQ-EYE-LADY") \
    X(DP_SEQ_D_03                 , "DP-SEQ-D-03") \
    X(DP_SEQ_D_SAFARI             , "DP-SEQ-D-SAFARI") \
    X(DP_SEQ_EYE_MYS              , "DP-SEQ-EYE-MYS") \
    X(DP_SEQ_BLD_GAME             , "DP-SEQ-BLD-GAME") \
    X(DP_SEQ_SLOT_ATARI           , "DP-SEQ-SLOT-ATARI") \
    X(DP_SEQ_SLOT_OOATARI         , "DP-SEQ-SLOT-OOATARI") \
    X(DP_SEQ_EYE_RICH             , "DP-SEQ-EYE-RICH") \
    X(DP_SEQ_D_RYAYHY             , "DP-SEQ-D-RYAYHY") \
    X(DP_SEQ_BA_DPOKE1            , "DP-SEQ-BA-DPOKE1") \
    X(DP_SEQ_KUSAGASA             , "DP-SEQ-KUSAGASA") \
    X(DP_SEQ_EYE_FUN              , "DP-SEQ-EYE-FUN") \
    X(DP_SEQ_D_KOUEN              , "DP-SEQ-D-KOUEN") \
    X(DP_SEQ_ACCE                 , "DP-SEQ-ACCE") \
    X(DP_SEQ_BLD_CON              , "DP-SEQ-BLD-CON") \
    X(DP_SEQ_KINOMI1              , "DP-SEQ-KINOMI1") \
    X(DP_SEQ_CON_TEST             , "DP-SEQ-CON-TEST") \
    X(DP_SEQ_CO_DRESS             , "DP-SEQ-CO-DRESS") \
    X(DP_SEQ_CO_KASHI             , "DP-SEQ-CO-KASHI") \
    X(DP_SEQ_CO_TAKUMA            , "DP-SEQ-CO-TAKUMA") \
    X(DP_SEQ_CO_KEKKA             , "DP-SEQ-CO-KEKKA") \
    X(DP_SEQ_CO_FANFA             , "DP-SEQ-CO-FANFA") \
    X(DP_SEQ_BF_TOWWER            , "DP-SEQ-BF-TOWWER") \
    X(DP_SEQ_D_06                 , "DP-SEQ-D-06") \
    X(DP_SEQ_BA_SECRET2           , "DP-SEQ-BA-SECRET2") \
    X(DP_SEQ_PRESENT              , "DP-SEQ-PRESENT") \
    X(DP_SEQ_D_LEAGUE             , "DP-SEQ-D-LEAGUE") \
    X(DP_SEQ_EYE_TENNO            , "DP-SEQ-EYE-TENNO") \
    X(DP_SEQ_BA_TENNO             , "DP-SEQ-BA-TENNO") \
    X(DP_SEQ_WINTENNO             , "DP-SEQ-WINTENNO") \
    X(DP_SEQ_EYE_CHAMP            , "DP-SEQ-EYE-CHAMP") \
    X(DP_SEQ_BA_CHANP             , "DP-SEQ-BA-CHANP") \
    X(DP_SEQ_WINCHAMP             , "DP-SEQ-WINCHAMP") \
    X(DP_SEQ_BLD_DENDO            , "DP-SEQ-BLD-DENDO") \
    X(DP_SEQ_BLD_EV_DENDO2        , "DP-SEQ-BLD-EV-DENDO2") \
    X(DP_SEQ_BLD_ENDING           , "DP-SEQ-BLD-ENDING") \
    X(DP_SEQ_FUE                  , "DP-SEQ-FUE") \
    X(DP_SEQ_AUS                  , "DP-SEQ-AUS") \
    X(DP_SEQ_BA_SECRET1           , "DP-SEQ-BA-SECRET1") \
    X(PL_SEQ_TITLE00              , "PL-SEQ-TITLE00") \
    X(PL_SEQ_TITLE01              , "PL-SEQ-TITLE01") \
    X(PL_SEQ_TV_HOUSOU            , "PL-SEQ-TV-HOUSOU") \
    X(PL_SEQ_TV_END               , "PL-SEQ-TV-END") \
    X(PL_SEQ_PL_HANDSOME          , "PL-SEQ-PL-HANDSOME") \
    X(PL_SEQ_PL_WIFITOWER         , "PL-SEQ-PL-WIFITOWER") \
    X(PL_SEQ_PL_WIFIUNION         , "PL-SEQ-PL-WIFIUNION") \
    X(PL_SEQ_PL_WIFIGAME          , "PL-SEQ-PL-WIFIGAME") \
    X(PL_SEQ_PL_WINMINI2          , "PL-SEQ-PL-WINMINI2") \
    X(PL_SEQ_PL_WIFIPARADE        , "PL-SEQ-PL-WIFIPARADE") \
    X(PL_SEQ_PL_EV_GIRA           , "PL-SEQ-PL-EV-GIRA") \
    X(PL_SEQ_PL_EV_GIRA2          , "PL-SEQ-PL-EV-GIRA2") \
    X(PL_SEQ_PL_D_GIRATINA        , "PL-SEQ-PL-D-GIRATINA") \
    X(PL_SEQ_PL_BA_GIRA           , "PL-SEQ-PL-BA-GIRA") \
    X(PL_SEQ_PL_GURUGURU          , "PL-SEQ-PL-GURUGURU") \
    X(PL_SEQ_PL_PTHAIFU           , "PL-SEQ-PL-PTHAIFU") \
    X(PL_SEQ_PL_MTKAWA            , "PL-SEQ-PL-MTKAWA") \
    X(PL_SEQ_PL_MTKAKKO           , "PL-SEQ-PL-MTKAKKO") \
    X(PL_SEQ_PL_MTTAKMA           , "PL-SEQ-PL-MTTAKMA") \
    X(PL_SEQ_PL_MTUTSUK           , "PL-SEQ-PL-MTUTSUK") \
    X(PL_SEQ_PL_MTKASHI           , "PL-SEQ-PL-MTKASHI") \
    X(PL_SEQ_PL_TOWN02            , "PL-SEQ-PL-TOWN02") \
    X(PL_SEQ_PL_AUDIO             , "PL-SEQ-PL-AUDIO") \
    X(PL_SEQ_CITY11_D             , "PL-SEQ-CITY11-D") \
    X(PL_SEQ_PL_BF_ROULETTE       , "PL-SEQ-PL-BF-ROULETTE") \
    X(PL_SEQ_PL_DON2              , "PL-SEQ-PL-DON2") \
    X(PL_SEQ_PL_BF_STAGE          , "PL-SEQ-PL-BF-STAGE") \
    X(PL_SEQ_PL_BF_FACTORY        , "PL-SEQ-PL-BF-FACTORY") \
    X(PL_SEQ_PL_BF_CASTLE         , "PL-SEQ-PL-BF-CASTLE") \
    X(PL_SEQ_PL_FRO               , "PL-SEQ-PL-FRO") \
    X(PL_SEQ_PL_POINTGET3         , "PL-SEQ-PL-POINTGET3") \
    X(PL_SEQ_PL_BA_BRAIN          , "PL-SEQ-PL-BA-BRAIN") \
    X(PL_SEQ_PL_WINBRAIN          , "PL-SEQ-PL-WINBRAIN") \
    X(PL_SEQ_PL_BA_REGI           , "PL-SEQ-PL-BA-REGI") \
    X(HG_SEQ_GS_TITLE,              "HG-SEQ-GS-TITLE") \
    X(HG_SEQ_GS_POKEMON_THEME,      "HG-SEQ-GS-POKEMON-THEME") \
    X(HG_SEQ_GS_STARTING,           "HG-SEQ-GS-STARTING") \
    X(HG_SEQ_GS_T_WAKABA,           "HG-SEQ-GS-T-WAKABA") \
    X(HG_SEQ_GS_E_TSURETEKE1,       "HG-SEQ-GS-E-TSURETEKE1") \
    X(HG_SEQ_GS_E_SUPPORT_F,        "HG-SEQ-GS-E-SUPPORT-F") \
    X(HG_SEQ_GS_E_SUPPORT_M,        "HG-SEQ-GS-E-SUPPORT-M") \
    X(HG_SEQ_GS_UTSUGI_RABO,        "HG-SEQ-GS-UTSUGI-RABO") \
    X(HG_SEQ_ME_KEYITEM,            "HG-SEQ-ME-KEYITEM") \
    X(HG_SEQ_GS_R_1_29,             "HG-SEQ-GS-R-1-29") \
    X(HG_SEQ_GS_VS_NORAPOKE,        "HG-SEQ-GS-VS-NORAPOKE") \
    X(HG_SEQ_GS_WIN2,               "HG-SEQ-GS-WIN2") \
    X(HG_SEQ_GS_WIN2_NOT_FAN,       "HG-SEQ-GS-WIN2-NOT-FAN") \
    X(HG_SEQ_ME_LVUP,               "HG-SEQ-ME-LVUP") \
    X(HG_SEQ_GS_C_YOSHINO,          "HG-SEQ-GS-C-YOSHINO") \
    X(HG_SEQ_GS_E_TSURETEKE2,       "HG-SEQ-GS-E-TSURETEKE2") \
    X(HG_SEQ_GS_POKESEN,            "HG-SEQ-GS-POKESEN") \
    X(HG_SEQ_ME_ASA,                "HG-SEQ-ME-ASA") \
    X(HG_SEQ_GS_EYE_J_SHOUNEN,      "HG-SEQ-GS-EYE-J-SHOUNEN") \
    X(HG_SEQ_GS_VS_TRAINER,         "HG-SEQ-GS-VS-TRAINER") \
    X(HG_SEQ_GS_WIN1,               "HG-SEQ-GS-WIN1") \
    X(HG_SEQ_GS_R_1_30,             "HG-SEQ-GS-R-1-30") \
    X(HG_SEQ_ME_HYOUKA1,            "HG-SEQ-ME-HYOUKA1") \
    X(HG_SEQ_GS_C_KIKYOU,           "HG-SEQ-GS-C-KIKYOU") \
    X(HG_SEQ_GS_TO_MADATSUBOMI1,    "HG-SEQ-GS-TO-MADATSUBOMI1") \
    X(HG_SEQ_GS_EYE_BOUZU,          "HG-SEQ-GS-EYE-BOUZU") \
    X(HG_SEQ_GS_FS,                 "HG-SEQ-GS-FS") \
    X(HG_SEQ_ME_TAMAGO_GET,         "HG-SEQ-ME-TAMAGO-GET") \
    X(HG_SEQ_GS_E_MAIKO_THEME,      "HG-SEQ-GS-E-MAIKO-THEME") \
    X(HG_SEQ_GS_D_CHIKATSUURO,      "HG-SEQ-GS-D-CHIKATSUURO") \
    X(HG_SEQ_ME_ITEM,               "HG-SEQ-ME-ITEM") \
    X(HG_SEQ_GS_D_UNKNOWN_ISEKI,    "HG-SEQ-GS-D-UNKNOWN-ISEKI") \
    X(HG_SEQ_GS_RADIO_UNKNOWN,      "HG-SEQ-GS-RADIO-UNKNOWN") \
    X(HG_SEQ_ME_HYOUKA2,            "HG-SEQ-ME-HYOUKA2") \
    X(HG_SEQ_GS_T_HIWADA,           "HG-SEQ-GS-T-HIWADA") \
    X(HG_SEQ_GS_EYE_ROCKET,         "HG-SEQ-GS-EYE-ROCKET") \
    X(HG_SEQ_GS_VS_ROCKET,          "HG-SEQ-GS-VS-ROCKET") \
    X(HG_SEQ_GS_R_4_34,             "HG-SEQ-GS-R-4-34") \
    X(HG_SEQ_GS_E_RIVAL1,           "HG-SEQ-GS-E-RIVAL1") \
    X(HG_SEQ_GS_VS_RIVAL,           "HG-SEQ-GS-VS-RIVAL") \
    X(HG_SEQ_GS_SHINKA,             "HG-SEQ-GS-SHINKA") \
    X(HG_SEQ_GS_KOUKAN,             "HG-SEQ-GS-KOUKAN") \
    X(HG_SEQ_ME_SHINKAOME,          "HG-SEQ-ME-SHINKAOME") \
    X(HG_SEQ_GS_C_KOGANE,           "HG-SEQ-GS-C-KOGANE") \
    X(HG_SEQ_GS_GYM,                "HG-SEQ-GS-GYM") \
    X(HG_SEQ_GS_VS_GYMREADER,       "HG-SEQ-GS-VS-GYMREADER") \
    X(HG_SEQ_GS_WIN3,               "HG-SEQ-GS-WIN3") \
    X(HG_SEQ_ME_BADGE,              "HG-SEQ-ME-BADGE") \
    X(HG_SEQ_GS_RADIO_JINGLE,       "HG-SEQ-GS-RADIO-JINGLE") \
    X(HG_SEQ_GS_AIKOTOBA,           "HG-SEQ-GS-AIKOTOBA") \
    X(HG_SEQ_ME_WAZA,               "HG-SEQ-ME-WAZA") \
    X(HG_SEQ_GS_GAME,               "HG-SEQ-GS-GAME") \
    X(HG_SEQ_GS_GAMEATARI,          "HG-SEQ-GS-GAMEATARI") \
    X(HG_SEQ_ME_CARDGAME1,          "HG-SEQ-ME-CARDGAME1") \
    X(HG_SEQ_ME_CARDGAME2,          "HG-SEQ-ME-CARDGAME2") \
    X(HG_SEQ_ME_ACCE,               "HG-SEQ-ME-ACCE") \
    X(HG_SEQ_GS_WIFITOWER,          "HG-SEQ-GS-WIFITOWER") \
    X(HG_SEQ_GS_BLD_GTC,            "HG-SEQ-GS-BLD-GTC") \
    X(HG_SEQ_ME_HYOUKA3,            "HG-SEQ-ME-HYOUKA3") \
    X(HG_SEQ_PL_BICYCLE,            "HG-SEQ-PL-BICYCLE") \
    X(HG_SEQ_GS_EYE_J_SHOUJO,       "HG-SEQ-GS-EYE-J-SHOUJO") \
    X(HG_SEQ_ME_POKEGEAR_REGIST,    "HG-SEQ-ME-POKEGEAR-REGIST") \
    X(HG_SEQ_GS_D_KOUEN,            "HG-SEQ-GS-D-KOUEN") \
    X(HG_SEQ_ME_KINOMI,             "HG-SEQ-ME-KINOMI") \
    X(HG_SEQ_GS_C_ENJU,             "HG-SEQ-GS-C-ENJU") \
    X(HG_SEQ_GS_KABURENJOU,         "HG-SEQ-GS-KABURENJOU") \
    X(HG_SEQ_GS_TO_YAKETA,          "HG-SEQ-GS-TO-YAKETA") \
    X(HG_SEQ_GS_E_MINAKI,           "HG-SEQ-GS-E-MINAKI") \
    X(HG_SEQ_GS_OHKIDO_RABO,        "HG-SEQ-GS-OHKIDO-RABO") \
    X(HG_SEQ_ME_HYOUKA4,            "HG-SEQ-ME-HYOUKA4") \
    X(HG_SEQ_GS_R_6_38,             "HG-SEQ-GS-R-6-38") \
    X(HG_SEQ_GS_RADIO_MARCH,        "HG-SEQ-GS-RADIO-MARCH") \
    X(HG_SEQ_GS_VS_RAIKOU,          "HG-SEQ-GS-VS-RAIKOU") \
    X(HG_SEQ_GS_TO_TOUDAI,          "HG-SEQ-GS-TO-TOUDAI") \
    X(HG_SEQ_GS_NAMINORI,           "HG-SEQ-GS-NAMINORI") \
    X(HG_SEQ_GS_C_TANBA,            "HG-SEQ-GS-C-TANBA") \
    X(HG_SEQ_ME_PT_SPECIAL,         "HG-SEQ-ME-PT-SPECIAL") \
    X(HG_SEQ_GS_R_7_42,             "HG-SEQ-GS-R-7-42") \
    X(HG_SEQ_GS_KAIDENPA,           "HG-SEQ-GS-KAIDENPA") \
    X(HG_SEQ_GS_D_AJITO,            "HG-SEQ-GS-D-AJITO") \
    X(HG_SEQ_GS_EYE_J_AYASHII,      "HG-SEQ-GS-EYE-J-AYASHII") \
    X(HG_SEQ_GS_E_RIVAL2,           "HG-SEQ-GS-E-RIVAL2") \
    X(HG_SEQ_GS_SENKYO,             "HG-SEQ-GS-SENKYO") \
    X(HG_SEQ_GS_D_KOORINONUKE,      "HG-SEQ-GS-D-KOORINONUKE") \
    X(HG_SEQ_ME_WASURE,             "HG-SEQ-ME-WASURE") \
    X(HG_SEQ_GS_RYUUNOANA,          "HG-SEQ-GS-RYUUNOANA") \
    X(HG_SEQ_GS_IBUKI,              "HG-SEQ-GS-IBUKI") \
    X(HG_SEQ_GS_VS_ENTEI,           "HG-SEQ-GS-VS-ENTEI") \
    X(HG_SEQ_GS_TO_SUZU,            "HG-SEQ-GS-TO-SUZU") \
    X(HG_SEQ_GS_E_MAIKO_MAI,        "HG-SEQ-GS-E-MAIKO-MAI") \
    X(HG_SEQ_GS_E_HOUOU,            "HG-SEQ-GS-E-HOUOU") \
    X(HG_SEQ_GS_VS_HOUOU,           "HG-SEQ-GS-VS-HOUOU") \
    X(HG_SEQ_GS_R_1_26,             "HG-SEQ-GS-R-1-26") \
    X(HG_SEQ_GS_KOUSOKUSEN,         "HG-SEQ-GS-KOUSOKUSEN") \
    X(HG_SEQ_GS_C_KUCHIBA,          "HG-SEQ-GS-C-KUCHIBA") \
    X(HG_SEQ_GS_VS_GYMREADER_KANTO, "HG-SEQ-GS-VS-GYMREADER-KANTO") \
    X(HG_SEQ_GS_T_CHION,            "HG-SEQ-GS-T-CHION") \
    X(HG_SEQ_GS_D_IWAYAMA,          "HG-SEQ-GS-D-IWAYAMA") \
    X(HG_SEQ_GS_VS_NORAPOKE_KANTO,  "HG-SEQ-GS-VS-NORAPOKE-KANTO") \
    X(HG_SEQ_ME_HYOUKA5,            "HG-SEQ-ME-HYOUKA5") \
    X(HG_SEQ_GS_C_HANADA,           "HG-SEQ-GS-C-HANADA") \
    X(HG_SEQ_GS_R_12_24,            "HG-SEQ-GS-R-12-24") \
    X(HG_SEQ_GS_E_LINEAR,           "HG-SEQ-GS-E-LINEAR") \
    X(HG_SEQ_GS_RADIO_KOMORIUTA,    "HG-SEQ-GS-RADIO-KOMORIUTA") \
    X(HG_SEQ_GS_VS_SUICUNE,         "HG-SEQ-GS-VS-SUICUNE") \
    X(HG_SEQ_GS_C_TAMAMUSHI,        "HG-SEQ-GS-C-TAMAMUSHI") \
    X(HG_SEQ_GS_R_10_11,            "HG-SEQ-GS-R-10-11") \
    X(HG_SEQ_GS_HUE,                "HG-SEQ-GS-HUE") \
    X(HG_SEQ_GS_D_TOKIWANOMORI,     "HG-SEQ-GS-D-TOKIWANOMORI") \
    X(HG_SEQ_GS_EYE_K_SHOUNEN,      "HG-SEQ-GS-EYE-K-SHOUNEN") \
    X(HG_SEQ_GS_C_YAMABUKI,         "HG-SEQ-GS-C-YAMABUKI") \
    X(HG_SEQ_GS_R_9_03,             "HG-SEQ-GS-R-9-03") \
    X(HG_SEQ_GS_EYE_K_AYASHII,      "HG-SEQ-GS-EYE-K-AYASHII") \
    X(HG_SEQ_GS_OTSUKIMI_EVENT,     "HG-SEQ-GS-OTSUKIMI-EVENT") \
    X(HG_SEQ_GS_R_9_01,             "HG-SEQ-GS-R-9-01") \
    X(HG_SEQ_GS_T_MASARA,           "HG-SEQ-GS-T-MASARA") \
    X(HG_SEQ_GS_OHKIDO,             "HG-SEQ-GS-OHKIDO") \
    X(HG_SEQ_ME_HYOUKA6,            "HG-SEQ-ME-HYOUKA6") \
    X(HG_SEQ_GS_EYE_K_SHOUJO,       "HG-SEQ-GS-EYE-K-SHOUJO") \
    X(HG_SEQ_GS_VS_TRAINER_KANTO,   "HG-SEQ-GS-VS-TRAINER-KANTO") \
    X(HG_SEQ_GS_T_GUREN,            "HG-SEQ-GS-T-GUREN") \
    X(HG_SEQ_GS_SAFARI_ROAD,        "HG-SEQ-GS-SAFARI-ROAD") \
    X(HG_SEQ_GS_SAFARI_HOUSE,       "HG-SEQ-GS-SAFARI-HOUSE") \
    X(HG_SEQ_GS_SAFARI_FIELD,       "HG-SEQ-GS-SAFARI-FIELD") \
    X(HG_SEQ_GS_RADIO_VARIETY,      "HG-SEQ-GS-RADIO-VARIETY") \
    X(HG_SEQ_GS_TAIKAIMAE,          "HG-SEQ-GS-TAIKAIMAE") \
    X(HG_SEQ_GS_TAIKAI,             "HG-SEQ-GS-TAIKAI") \
    X(HG_SEQ_ME_MUSHITORI3,         "HG-SEQ-ME-MUSHITORI3") \
    X(HG_SEQ_ME_MUSHITORI2,         "HG-SEQ-ME-MUSHITORI2") \
    X(HG_SEQ_ME_MUSHITORI1,         "HG-SEQ-ME-MUSHITORI1") \
    X(HG_SEQ_GS_PT_ENTR,            "HG-SEQ-GS-PT-ENTR") \
    X(HG_SEQ_ME_PT_NEW,             "HG-SEQ-ME-PT-NEW") \
    X(HG_SEQ_GS_PT_OPEN,            "HG-SEQ-GS-PT-OPEN") \
    X(HG_SEQ_GS_PT_TITLE,           "HG-SEQ-GS-PT-TITLE") \
    X(HG_SEQ_GS_PT_GAME,            "HG-SEQ-GS-PT-GAME") \
    X(HG_SEQ_ME_PT_RESULTG,         "HG-SEQ-ME-PT-RESULTG") \
    X(HG_SEQ_GS_PT_GAMEF,           "HG-SEQ-GS-PT-GAMEF") \
    X(HG_SEQ_GS_PT_RESULT,          "HG-SEQ-GS-PT-RESULT") \
    X(HG_SEQ_GS_PT_END,             "HG-SEQ-GS-PT-END") \
    X(HG_SEQ_GS_PT_VICTORY,         "HG-SEQ-GS-PT-VICTORY") \
    X(HG_SEQ_GS_WIFI_PRESENT,       "HG-SEQ-GS-WIFI-PRESENT") \
    X(HG_SEQ_GS_BATTLETOWER2,       "HG-SEQ-GS-BATTLETOWER2") \
    X(HG_SEQ_GS_BATTLETOWER,        "HG-SEQ-GS-BATTLETOWER") \
    X(HG_SEQ_ME_BPGET,              "HG-SEQ-ME-BPGET") \
    X(HG_SEQ_GS_BF_FACTORY,         "HG-SEQ-GS-BF-FACTORY") \
    X(HG_SEQ_GS_BF_STAGE,           "HG-SEQ-GS-BF-STAGE") \
    X(HG_SEQ_GS_BF_ROULETTE,        "HG-SEQ-GS-BF-ROULETTE") \
    X(HG_SEQ_ME_ROULETTE,           "HG-SEQ-ME-ROULETTE") \
    X(HG_SEQ_GS_BF_CASTLE,          "HG-SEQ-GS-BF-CASTLE") \
    X(HG_SEQ_ME_CASTLE,             "HG-SEQ-ME-CASTLE") \
    X(HG_SEQ_GS_BA_BRAIN,           "HG-SEQ-GS-BA-BRAIN") \
    X(HG_SEQ_GS_WINBRAIN,           "HG-SEQ-GS-WINBRAIN") \
    X(HG_SEQ_GS_RADIO_TRAINER,      "HG-SEQ-GS-RADIO-TRAINER") \
    X(HG_SEQ_GS_GURUGURU,           "HG-SEQ-GS-GURUGURU") \
    X(HG_SEQ_GS_WIFI_ACCESS,        "HG-SEQ-GS-WIFI-ACCESS") \
    X(HG_SEQ_GS_WIFIUNION,          "HG-SEQ-GS-WIFIUNION") \
    X(HG_SEQ_GS_WIFIGAME,           "HG-SEQ-GS-WIFIGAME") \
    X(HG_SEQ_ME_MINIGAME,           "HG-SEQ-ME-MINIGAME") \
    X(HG_SEQ_GS_WIFIPARADE,         "HG-SEQ-GS-WIFIPARADE") \
    X(HG_SEQ_GS_RADIO_R_101,        "HG-SEQ-GS-RADIO-R-101") \
    X(HG_SEQ_GS_RADIO_R_201,        "HG-SEQ-GS-RADIO-R-201") \
    X(HG_SEQ_GS_PHC,                "HG-SEQ-GS-PHC") \
    X(HG_SEQ_GS_E_G_PICHU,          "HG-SEQ-GS-E-G-PICHU") \
    X(HG_SEQ_GS_EYE_MAIKO,          "HG-SEQ-GS-EYE-MAIKO") \
    X(HG_SEQ_GS_E_LUGIA,            "HG-SEQ-GS-E-LUGIA") \
    X(HG_SEQ_GS_VS_LUGIA,           "HG-SEQ-GS-VS-LUGIA") \
    X(HG_SEQ_GS_D_CHAMPROAD,        "HG-SEQ-GS-D-CHAMPROAD") \
    X(HG_SEQ_GS_CHAMPROAD,          "HG-SEQ-GS-CHAMPROAD") \
    X(HG_SEQ_GS_VS_CHAMP,           "HG-SEQ-GS-VS-CHAMP") \
    X(HG_SEQ_GS_E_DENDOURIRI,       "HG-SEQ-GS-E-DENDOURIRI") \
    X(HG_SEQ_GS_ENDING,             "HG-SEQ-GS-ENDING") \
    X(HG_SEQ_GS_ENDING2,            "HG-SEQ-GS-ENDING2") \
    X(HG_SEQ_GS_VS_KODAI,           "HG-SEQ-GS-VS-KODAI") \
    X(HG_SEQ_GS_D_SHINTO,           "HG-SEQ-GS-D-SHINTO") \
    X(HG_SEQ_GS_E_ARCEUS,           "HG-SEQ-GS-E-ARCEUS") \
    X(HG_SEQ_ME_GONIN,              "HG-SEQ-ME-GONIN") \

#define SOUND_LIST_SE \
    X(SE_USE_ITEM, "SE-USE-ITEM") \
    X(SE_PC_LOGIN, "SE-PC-LOGIN") \
    X(SE_PC_OFF, "SE-PC-OFF") \
    X(SE_PC_ON, "SE-PC-ON") \
    X(SE_SELECT, "SE-SELECT") \
    X(SE_WIN_OPEN, "SE-WIN-OPEN") \
    X(SE_WALL_HIT, "SE-WALL-HIT") \
    X(SE_DOOR, "SE-DOOR") \
    X(SE_EXIT, "SE-EXIT") \
    X(SE_LEDGE, "SE-LEDGE") \
    X(SE_BIKE_BELL, "SE-BIKE-BELL") \
    X(SE_NOT_EFFECTIVE, "SE-NOT-EFFECTIVE") \
    X(SE_EFFECTIVE, "SE-EFFECTIVE") \
    X(SE_SUPER_EFFECTIVE, "SE-SUPER-EFFECTIVE") \
    X(SE_BALL_OPEN, "SE-BALL-OPEN") \
    X(SE_FAINT, "SE-FAINT") \
    X(SE_FLEE, "SE-FLEE") \
    X(SE_SLIDING_DOOR, "SE-SLIDING-DOOR") \
    X(SE_SHIP, "SE-SHIP") \
    X(SE_BANG, "SE-BANG") \
    X(SE_PIN, "SE-PIN") \
    X(SE_BOO, "SE-BOO") \
    X(SE_BALL, "SE-BALL") \
    X(SE_CONTEST_PLACE, "SE-CONTEST-PLACE") \
    X(SE_A, "SE-A") \
    X(SE_I, "SE-I") \
    X(SE_U, "SE-U") \
    X(SE_E, "SE-E") \
    X(SE_O, "SE-O") \
    X(SE_N, "SE-N") \
    X(SE_SUCCESS, "SE-SUCCESS") \
    X(SE_FAILURE, "SE-FAILURE") \
    X(SE_EXP, "SE-EXP") \
    X(SE_BIKE_HOP, "SE-BIKE-HOP") \
    X(SE_SWITCH, "SE-SWITCH") \
    X(SE_CLICK, "SE-CLICK") \
    X(SE_FU_ZAKU, "SE-FU-ZAKU") \
    X(SE_CONTEST_CONDITION_LOSE, "SE-CONTEST-CONDITION-LOSE") \
    X(SE_LAVARIDGE_FALL_WARP, "SE-LAVARIDGE-FALL-WARP") \
    X(SE_ICE_STAIRS, "SE-ICE-STAIRS") \
    X(SE_ICE_BREAK, "SE-ICE-BREAK") \
    X(SE_ICE_CRACK, "SE-ICE-CRACK") \
    X(SE_FALL, "SE-FALL") \
    X(SE_UNLOCK, "SE-UNLOCK") \
    X(SE_WARP_IN, "SE-WARP-IN") \
    X(SE_WARP_OUT, "SE-WARP-OUT") \
    X(SE_REPEL, "SE-REPEL") \
    X(SE_ROTATING_GATE, "SE-ROTATING-GATE") \
    X(SE_TRUCK_MOVE, "SE-TRUCK-MOVE") \
    X(SE_TRUCK_STOP, "SE-TRUCK-STOP") \
    X(SE_TRUCK_UNLOAD, "SE-TRUCK-UNLOAD") \
    X(SE_TRUCK_DOOR, "SE-TRUCK-DOOR") \
    X(SE_BERRY_BLENDER, "SE-BERRY-BLENDER") \
    X(SE_CARD, "SE-CARD") \
    X(SE_SAVE, "SE-SAVE") \
    X(SE_BALL_BOUNCE_1, "SE-BALL-BOUNCE-1") \
    X(SE_BALL_BOUNCE_2, "SE-BALL-BOUNCE-2") \
    X(SE_BALL_BOUNCE_3, "SE-BALL-BOUNCE-3") \
    X(SE_BALL_BOUNCE_4, "SE-BALL-BOUNCE-4") \
    X(SE_BALL_TRADE, "SE-BALL-TRADE") \
    X(SE_BALL_THROW, "SE-BALL-THROW") \
    X(SE_NOTE_C, "SE-NOTE-C") \
    X(SE_NOTE_D, "SE-NOTE-D") \
    X(SE_NOTE_E, "SE-NOTE-E") \
    X(SE_NOTE_F, "SE-NOTE-F") \
    X(SE_NOTE_G, "SE-NOTE-G") \
    X(SE_NOTE_A, "SE-NOTE-A") \
    X(SE_NOTE_B, "SE-NOTE-B") \
    X(SE_NOTE_C_HIGH, "SE-NOTE-C-HIGH") \
    X(SE_PUDDLE, "SE-PUDDLE") \
    X(SE_BRIDGE_WALK, "SE-BRIDGE-WALK") \
    X(SE_ITEMFINDER, "SE-ITEMFINDER") \
    X(SE_DING_DONG, "SE-DING-DONG") \
    X(SE_BALLOON_RED, "SE-BALLOON-RED") \
    X(SE_BALLOON_BLUE, "SE-BALLOON-BLUE") \
    X(SE_BALLOON_YELLOW, "SE-BALLOON-YELLOW") \
    X(SE_BREAKABLE_DOOR, "SE-BREAKABLE-DOOR") \
    X(SE_MUD_BALL, "SE-MUD-BALL") \
    X(SE_FIELD_POISON, "SE-FIELD-POISON") \
    X(SE_ESCALATOR, "SE-ESCALATOR") \
    X(SE_THUNDERSTORM, "SE-THUNDERSTORM") \
    X(SE_THUNDERSTORM_STOP, "SE-THUNDERSTORM-STOP") \
    X(SE_DOWNPOUR, "SE-DOWNPOUR") \
    X(SE_DOWNPOUR_STOP, "SE-DOWNPOUR-STOP") \
    X(SE_RAIN, "SE-RAIN") \
    X(SE_RAIN_STOP, "SE-RAIN-STOP") \
    X(SE_THUNDER, "SE-THUNDER") \
    X(SE_THUNDER2, "SE-THUNDER2") \
    X(SE_ELEVATOR, "SE-ELEVATOR") \
    X(SE_LOW_HEALTH, "SE-LOW-HEALTH") \
    X(SE_EXP_MAX, "SE-EXP-MAX") \
    X(SE_ROULETTE_BALL, "SE-ROULETTE-BALL") \
    X(SE_ROULETTE_BALL2, "SE-ROULETTE-BALL2") \
    X(SE_TAILLOW_WING_FLAP, "SE-TAILLOW-WING-FLAP") \
    X(SE_SHOP, "SE-SHOP") \
    X(SE_CONTEST_HEART, "SE-CONTEST-HEART") \
    X(SE_CONTEST_CURTAIN_RISE, "SE-CONTEST-CURTAIN-RISE") \
    X(SE_CONTEST_CURTAIN_FALL, "SE-CONTEST-CURTAIN-FALL") \
    X(SE_CONTEST_ICON_CHANGE, "SE-CONTEST-ICON-CHANGE") \
    X(SE_CONTEST_ICON_CLEAR, "SE-CONTEST-ICON-CLEAR") \
    X(SE_CONTEST_MONS_TURN, "SE-CONTEST-MONS-TURN") \
    X(SE_SHINY, "SE-SHINY") \
    X(SE_INTRO_BLAST, "SE-INTRO-BLAST") \
    X(SE_MUGSHOT, "SE-MUGSHOT") \
    X(SE_APPLAUSE, "SE-APPLAUSE") \
    X(SE_VEND, "SE-VEND") \
    X(SE_ORB, "SE-ORB") \
    X(SE_DEX_SCROLL, "SE-DEX-SCROLL") \
    X(SE_DEX_PAGE, "SE-DEX-PAGE") \
    X(SE_POKENAV_ON, "SE-POKENAV-ON") \
    X(SE_POKENAV_OFF, "SE-POKENAV-OFF") \
    X(SE_DEX_SEARCH, "SE-DEX-SEARCH") \
    X(SE_EGG_HATCH, "SE-EGG-HATCH") \
    X(SE_BALL_TRAY_ENTER, "SE-BALL-TRAY-ENTER") \
    X(SE_BALL_TRAY_BALL, "SE-BALL-TRAY-BALL") \
    X(SE_BALL_TRAY_EXIT, "SE-BALL-TRAY-EXIT") \
    X(SE_GLASS_FLUTE, "SE-GLASS-FLUTE") \
    X(SE_M_THUNDERBOLT, "SE-M-THUNDERBOLT") \
    X(SE_M_THUNDERBOLT2, "SE-M-THUNDERBOLT2") \
    X(SE_M_HARDEN, "SE-M-HARDEN") \
    X(SE_M_NIGHTMARE, "SE-M-NIGHTMARE") \
    X(SE_M_VITAL_THROW, "SE-M-VITAL-THROW") \
    X(SE_M_VITAL_THROW2, "SE-M-VITAL-THROW2") \
    X(SE_M_BUBBLE, "SE-M-BUBBLE") \
    X(SE_M_BUBBLE2, "SE-M-BUBBLE2") \
    X(SE_M_BUBBLE3, "SE-M-BUBBLE3") \
    X(SE_M_RAIN_DANCE, "SE-M-RAIN-DANCE") \
    X(SE_M_CUT, "SE-M-CUT") \
    X(SE_M_STRING_SHOT, "SE-M-STRING-SHOT") \
    X(SE_M_STRING_SHOT2, "SE-M-STRING-SHOT2") \
    X(SE_M_ROCK_THROW, "SE-M-ROCK-THROW") \
    X(SE_M_GUST, "SE-M-GUST") \
    X(SE_M_GUST2, "SE-M-GUST2") \
    X(SE_M_DOUBLE_SLAP, "SE-M-DOUBLE-SLAP") \
    X(SE_M_DOUBLE_TEAM, "SE-M-DOUBLE-TEAM") \
    X(SE_M_RAZOR_WIND, "SE-M-RAZOR-WIND") \
    X(SE_M_ICY_WIND, "SE-M-ICY-WIND") \
    X(SE_M_THUNDER_WAVE, "SE-M-THUNDER-WAVE") \
    X(SE_M_COMET_PUNCH, "SE-M-COMET-PUNCH") \
    X(SE_M_MEGA_KICK, "SE-M-MEGA-KICK") \
    X(SE_M_MEGA_KICK2, "SE-M-MEGA-KICK2") \
    X(SE_M_CRABHAMMER, "SE-M-CRABHAMMER") \
    X(SE_M_JUMP_KICK, "SE-M-JUMP-KICK") \
    X(SE_M_FLAME_WHEEL, "SE-M-FLAME-WHEEL") \
    X(SE_M_FLAME_WHEEL2, "SE-M-FLAME-WHEEL2") \
    X(SE_M_FLAMETHROWER, "SE-M-FLAMETHROWER") \
    X(SE_M_FIRE_PUNCH, "SE-M-FIRE-PUNCH") \
    X(SE_M_TOXIC, "SE-M-TOXIC") \
    X(SE_M_SACRED_FIRE, "SE-M-SACRED-FIRE") \
    X(SE_M_SACRED_FIRE2, "SE-M-SACRED-FIRE2") \
    X(SE_M_EMBER, "SE-M-EMBER") \
    X(SE_M_TAKE_DOWN, "SE-M-TAKE-DOWN") \
    X(SE_M_BLIZZARD, "SE-M-BLIZZARD") \
    X(SE_M_BLIZZARD2, "SE-M-BLIZZARD2") \
    X(SE_M_SCRATCH, "SE-M-SCRATCH") \
    X(SE_M_VICEGRIP, "SE-M-VICEGRIP") \
    X(SE_M_WING_ATTACK, "SE-M-WING-ATTACK") \
    X(SE_M_FLY, "SE-M-FLY") \
    X(SE_M_SAND_ATTACK, "SE-M-SAND-ATTACK") \
    X(SE_M_RAZOR_WIND2, "SE-M-RAZOR-WIND2") \
    X(SE_M_BITE, "SE-M-BITE") \
    X(SE_M_HEADBUTT, "SE-M-HEADBUTT") \
    X(SE_M_SURF, "SE-M-SURF") \
    X(SE_M_HYDRO_PUMP, "SE-M-HYDRO-PUMP") \
    X(SE_M_WHIRLPOOL, "SE-M-WHIRLPOOL") \
    X(SE_M_HORN_ATTACK, "SE-M-HORN-ATTACK") \
    X(SE_M_TAIL_WHIP, "SE-M-TAIL-WHIP") \
    X(SE_M_MIST, "SE-M-MIST") \
    X(SE_M_POISON_POWDER, "SE-M-POISON-POWDER") \
    X(SE_M_BIND, "SE-M-BIND") \
    X(SE_M_DRAGON_RAGE, "SE-M-DRAGON-RAGE") \
    X(SE_M_SING, "SE-M-SING") \
    X(SE_M_PERISH_SONG, "SE-M-PERISH-SONG") \
    X(SE_M_PAY_DAY, "SE-M-PAY-DAY") \
    X(SE_M_DIG, "SE-M-DIG") \
    X(SE_M_DIZZY_PUNCH, "SE-M-DIZZY-PUNCH") \
    X(SE_M_SELF_DESTRUCT, "SE-M-SELF-DESTRUCT") \
    X(SE_M_EXPLOSION, "SE-M-EXPLOSION") \
    X(SE_M_ABSORB_2, "SE-M-ABSORB-2") \
    X(SE_M_ABSORB, "SE-M-ABSORB") \
    X(SE_M_SCREECH, "SE-M-SCREECH") \
    X(SE_M_BUBBLE_BEAM, "SE-M-BUBBLE-BEAM") \
    X(SE_M_BUBBLE_BEAM2, "SE-M-BUBBLE-BEAM2") \
    X(SE_M_SUPERSONIC, "SE-M-SUPERSONIC") \
    X(SE_M_BELLY_DRUM, "SE-M-BELLY-DRUM") \
    X(SE_M_METRONOME, "SE-M-METRONOME") \
    X(SE_M_BONEMERANG, "SE-M-BONEMERANG") \
    X(SE_M_LICK, "SE-M-LICK") \
    X(SE_M_PSYBEAM, "SE-M-PSYBEAM") \
    X(SE_M_FAINT_ATTACK, "SE-M-FAINT-ATTACK") \
    X(SE_M_SWORDS_DANCE, "SE-M-SWORDS-DANCE") \
    X(SE_M_LEER, "SE-M-LEER") \
    X(SE_M_SWAGGER, "SE-M-SWAGGER") \
    X(SE_M_SWAGGER2, "SE-M-SWAGGER2") \
    X(SE_M_HEAL_BELL, "SE-M-HEAL-BELL") \
    X(SE_M_CONFUSE_RAY, "SE-M-CONFUSE-RAY") \
    X(SE_M_SNORE, "SE-M-SNORE") \
    X(SE_M_BRICK_BREAK, "SE-M-BRICK-BREAK") \
    X(SE_M_GIGA_DRAIN, "SE-M-GIGA-DRAIN") \
    X(SE_M_PSYBEAM2, "SE-M-PSYBEAM2") \
    X(SE_M_SOLAR_BEAM, "SE-M-SOLAR-BEAM") \
    X(SE_M_PETAL_DANCE, "SE-M-PETAL-DANCE") \
    X(SE_M_TELEPORT, "SE-M-TELEPORT") \
    X(SE_M_MINIMIZE, "SE-M-MINIMIZE") \
    X(SE_M_SKETCH, "SE-M-SKETCH") \
    X(SE_M_SWIFT, "SE-M-SWIFT") \
    X(SE_M_REFLECT, "SE-M-REFLECT") \
    X(SE_M_BARRIER, "SE-M-BARRIER") \
    X(SE_M_DETECT, "SE-M-DETECT") \
    X(SE_M_LOCK_ON, "SE-M-LOCK-ON") \
    X(SE_M_MOONLIGHT, "SE-M-MOONLIGHT") \
    X(SE_M_CHARM, "SE-M-CHARM") \
    X(SE_M_CHARGE, "SE-M-CHARGE") \
    X(SE_M_STRENGTH, "SE-M-STRENGTH") \
    X(SE_M_HYPER_BEAM, "SE-M-HYPER-BEAM") \
    X(SE_M_WATERFALL, "SE-M-WATERFALL") \
    X(SE_M_REVERSAL, "SE-M-REVERSAL") \
    X(SE_M_ACID_ARMOR, "SE-M-ACID-ARMOR") \
    X(SE_M_SANDSTORM, "SE-M-SANDSTORM") \
    X(SE_M_TRI_ATTACK, "SE-M-TRI-ATTACK") \
    X(SE_M_TRI_ATTACK2, "SE-M-TRI-ATTACK2") \
    X(SE_M_ENCORE, "SE-M-ENCORE") \
    X(SE_M_ENCORE2, "SE-M-ENCORE2") \
    X(SE_M_BATON_PASS, "SE-M-BATON-PASS") \
    X(SE_M_MILK_DRINK, "SE-M-MILK-DRINK") \
    X(SE_M_ATTRACT, "SE-M-ATTRACT") \
    X(SE_M_ATTRACT2, "SE-M-ATTRACT2") \
    X(SE_M_MORNING_SUN, "SE-M-MORNING-SUN") \
    X(SE_M_FLATTER, "SE-M-FLATTER") \
    X(SE_M_SAND_TOMB, "SE-M-SAND-TOMB") \
    X(SE_M_GRASSWHISTLE, "SE-M-GRASSWHISTLE") \
    X(SE_M_SPIT_UP, "SE-M-SPIT-UP") \
    X(SE_M_DIVE, "SE-M-DIVE") \
    X(SE_M_EARTHQUAKE, "SE-M-EARTHQUAKE") \
    X(SE_M_TWISTER, "SE-M-TWISTER") \
    X(SE_M_SWEET_SCENT, "SE-M-SWEET-SCENT") \
    X(SE_M_YAWN, "SE-M-YAWN") \
    X(SE_M_SKY_UPPERCUT, "SE-M-SKY-UPPERCUT") \
    X(SE_M_STAT_INCREASE, "SE-M-STAT-INCREASE") \
    X(SE_M_HEAT_WAVE, "SE-M-HEAT-WAVE") \
    X(SE_M_UPROAR, "SE-M-UPROAR") \
    X(SE_M_HAIL, "SE-M-HAIL") \
    X(SE_M_COSMIC_POWER, "SE-M-COSMIC-POWER") \
    X(SE_M_TEETER_DANCE, "SE-M-TEETER-DANCE") \
    X(SE_M_STAT_DECREASE, "SE-M-STAT-DECREASE") \
    X(SE_M_HAZE, "SE-M-HAZE") \
    X(SE_M_HYPER_BEAM2, "SE-M-HYPER-BEAM2") \
    X(SE_RG_DOOR, "SE-RG-DOOR") \
    X(SE_RG_CARD_FLIP, "SE-RG-CARD-FLIP") \
    X(SE_RG_CARD_FLIPPING, "SE-RG-CARD-FLIPPING") \
    X(SE_RG_CARD_OPEN, "SE-RG-CARD-OPEN") \
    X(SE_RG_BAG_CURSOR, "SE-RG-BAG-CURSOR") \
    X(SE_RG_BAG_POCKET, "SE-RG-BAG-POCKET") \
    X(SE_RG_BALL_CLICK, "SE-RG-BALL-CLICK") \
    X(SE_RG_SHOP, "SE-RG-SHOP") \
    X(SE_RG_SS_ANNE_HORN, "SE-RG-SS-ANNE-HORN") \
    X(SE_RG_HELP_OPEN, "SE-RG-HELP-OPEN") \
    X(SE_RG_HELP_CLOSE, "SE-RG-HELP-CLOSE") \
    X(SE_RG_HELP_ERROR, "SE-RG-HELP-ERROR") \
    X(SE_RG_DEOXYS_MOVE, "SE-RG-DEOXYS-MOVE") \
    X(SE_RG_POKE_JUMP_SUCCESS, "SE-RG-POKE-JUMP-SUCCESS") \
    X(SE_RG_POKE_JUMP_FAILURE, "SE-RG-POKE-JUMP-FAILURE") \
    X(SE_PHONE_CALL, "SE-PHONE-CALL") \
    X(SE_PHONE_CLICK, "SE-PHONE-CLICK") \
    X(SE_ARENA_TIMEUP1, "SE-ARENA-TIMEUP1") \
    X(SE_ARENA_TIMEUP2, "SE-ARENA-TIMEUP2") \
    X(SE_PIKE_CURTAIN_CLOSE, "SE-PIKE-CURTAIN-CLOSE") \
    X(SE_PIKE_CURTAIN_OPEN, "SE-PIKE-CURTAIN-OPEN") \
    X(SE_SUDOWOODO_SHAKE, "SE-SUDOWOODO-SHAKE") \
    X(PH_TRAP_BLEND, "PH-TRAP-BLEND") \
    X(PH_TRAP_HELD, "PH-TRAP-HELD") \
    X(PH_TRAP_SOLO, "PH-TRAP-SOLO") \
    X(PH_FACE_BLEND, "PH-FACE-BLEND") \
    X(PH_FACE_HELD, "PH-FACE-HELD") \
    X(PH_FACE_SOLO, "PH-FACE-SOLO") \
    X(PH_CLOTH_BLEND, "PH-CLOTH-BLEND") \
    X(PH_CLOTH_HELD, "PH-CLOTH-HELD") \
    X(PH_CLOTH_SOLO, "PH-CLOTH-SOLO") \
    X(PH_DRESS_BLEND, "PH-DRESS-BLEND") \
    X(PH_DRESS_HELD, "PH-DRESS-HELD") \
    X(PH_DRESS_SOLO, "PH-DRESS-SOLO") \
    X(PH_FLEECE_BLEND, "PH-FLEECE-BLEND") \
    X(PH_FLEECE_HELD, "PH-FLEECE-HELD") \
    X(PH_FLEECE_SOLO, "PH-FLEECE-SOLO") \
    X(PH_KIT_BLEND, "PH-KIT-BLEND") \
    X(PH_KIT_HELD, "PH-KIT-HELD") \
    X(PH_KIT_SOLO, "PH-KIT-SOLO") \
    X(PH_PRICE_BLEND, "PH-PRICE-BLEND") \
    X(PH_PRICE_HELD, "PH-PRICE-HELD") \
    X(PH_PRICE_SOLO, "PH-PRICE-SOLO") \
    X(PH_LOT_BLEND, "PH-LOT-BLEND") \
    X(PH_LOT_HELD, "PH-LOT-HELD") \
    X(PH_LOT_SOLO, "PH-LOT-SOLO") \
    X(PH_GOAT_BLEND, "PH-GOAT-BLEND") \
    X(PH_GOAT_HELD, "PH-GOAT-HELD") \
    X(PH_GOAT_SOLO, "PH-GOAT-SOLO") \
    X(PH_THOUGHT_BLEND, "PH-THOUGHT-BLEND") \
    X(PH_THOUGHT_HELD, "PH-THOUGHT-HELD") \
    X(PH_THOUGHT_SOLO, "PH-THOUGHT-SOLO") \
    X(PH_CHOICE_BLEND, "PH-CHOICE-BLEND") \
    X(PH_CHOICE_HELD, "PH-CHOICE-HELD") \
    X(PH_CHOICE_SOLO, "PH-CHOICE-SOLO") \
    X(PH_MOUTH_BLEND, "PH-MOUTH-BLEND") \
    X(PH_MOUTH_HELD, "PH-MOUTH-HELD") \
    X(PH_MOUTH_SOLO, "PH-MOUTH-SOLO") \
    X(PH_FOOT_BLEND, "PH-FOOT-BLEND") \
    X(PH_FOOT_HELD, "PH-FOOT-HELD") \
    X(PH_FOOT_SOLO, "PH-FOOT-SOLO") \
    X(PH_GOOSE_BLEND, "PH-GOOSE-BLEND") \
    X(PH_GOOSE_HELD, "PH-GOOSE-HELD") \
    X(PH_GOOSE_SOLO, "PH-GOOSE-SOLO") \
    X(PH_STRUT_BLEND, "PH-STRUT-BLEND") \
    X(PH_STRUT_HELD, "PH-STRUT-HELD") \
    X(PH_STRUT_SOLO, "PH-STRUT-SOLO") \
    X(PH_CURE_BLEND, "PH-CURE-BLEND") \
    X(PH_CURE_HELD, "PH-CURE-HELD") \
    X(PH_CURE_SOLO, "PH-CURE-SOLO") \
    X(PH_NURSE_BLEND, "PH-NURSE-BLEND") \
    X(PH_NURSE_HELD, "PH-NURSE-HELD") \
    X(PH_NURSE_SOLO, "PH-NURSE-SOLO") \

// Create BGM list
#define X(songId, name) static const u8 sBGMName_##songId[] = _(name);
SOUND_LIST_BGM
#undef X

#define X(songId, name) sBGMName_##songId,
static const u8 *const gBGMNames[] =
{
SOUND_LIST_BGM
};
#undef X

// Create SE list
#define X(songId, name) static const u8 sSEName_##songId[] = _(name);
SOUND_LIST_SE
#undef X

#define X(songId, name) sSEName_##songId,
static const u8 *const gSENames[] =
{
SOUND_LIST_SE
};
#undef X

static void DebugAction_PresetWarp_LittlerootTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_OldaleTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_PetalburgCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), 3);
    DoWarp();
}
static void DebugAction_PresetWarp_RustboroCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), 3);
    DoWarp();
}
static void DebugAction_PresetWarp_DewfordTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), 1);
    DoWarp();
}
static void DebugAction_PresetWarp_SlateportCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), 0);
    DoWarp();
}
static void DebugAction_PresetWarp_MauvilleCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), 1);
    DoWarp();
}
static void DebugAction_PresetWarp_VerdanturfTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_FallarborTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_LavaridgeTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), 3);
    DoWarp();
}
static void DebugAction_PresetWarp_FortreeCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), 0);
    DoWarp();
}
static void DebugAction_PresetWarp_LilycoveCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_MossdeepCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), 2);
    DoWarp();
}
static void DebugAction_PresetWarp_PacifidlogTown(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), 0);
    DoWarp();
}
static void DebugAction_PresetWarp_SootopolisCity(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), 0);
    DoWarp();
}
static void DebugAction_PresetWarp_EverGrandeCityOuter(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 1);
    DoWarp();
}
static void DebugAction_PresetWarp_EverGrandeCityInner(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestinationToMapWarp(MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 0);
    DoWarp();
}
static void DebugAction_PresetWarp_PkmnLeagueSidney(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(EVER_GRANDE_CITY_SIDNEYS_ROOM), MAP_NUM(EVER_GRANDE_CITY_SIDNEYS_ROOM), -1, 6, 7);
    DoWarp();
}
static void DebugAction_PresetWarp_PkmnLeaguePhoebe(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(EVER_GRANDE_CITY_PHOEBES_ROOM), MAP_NUM(EVER_GRANDE_CITY_PHOEBES_ROOM), -1, 6, 7);
    DoWarp();
}
static void DebugAction_PresetWarp_PkmnLeagueGlacia(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(EVER_GRANDE_CITY_GLACIAS_ROOM), MAP_NUM(EVER_GRANDE_CITY_GLACIAS_ROOM), -1, 6, 7);
    DoWarp();
}
static void DebugAction_PresetWarp_PkmnLeagueDrake(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(EVER_GRANDE_CITY_DRAKES_ROOM), MAP_NUM(EVER_GRANDE_CITY_DRAKES_ROOM), -1, 6, 7);
    DoWarp();
}
static void DebugAction_PresetWarp_PkmnLeagueChampion(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(EVER_GRANDE_CITY_HALL4), MAP_NUM(EVER_GRANDE_CITY_HALL4), -1, 5, 4);
    DoWarp();
}
static void DebugAction_PresetWarp_BattleFactory(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_WEST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_WEST), -1, 11, 39);
    DoWarp();
}
static void DebugAction_PresetWarp_BattleArena(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_EAST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_EAST), -1, 39, 30);
    DoWarp();
}
static void DebugAction_PresetWarp_BattleDome(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_WEST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_WEST), -1, 19, 18);
    DoWarp();
}
static void DebugAction_PresetWarp_BattlePike(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_WEST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_WEST), -1, 42, 30);
    DoWarp();
}
static void DebugAction_PresetWarp_BattlePalace(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_EAST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_EAST), -1, 45, 57);
    DoWarp();
}
static void DebugAction_PresetWarp_BattlePyramid(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_EAST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_EAST), -1, 58, 15);
    DoWarp();
}
static void DebugAction_PresetWarp_BattleTower(u8 taskId)
{
    Debug_DestroyMenu(taskId, TRUE);
    SetWarpDestination(MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_EAST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_EAST), -1, 16, 15);
    DoWarp();
}
#endif
